mercredi 12 avril 2017

Integration tests for a Rails Shopify application

I am trying to write controller / integration tests for my Shopify application built with Rails 5 and the shopify_app gem.

The problem I am facing is I can't find out how to bypass the authentication process in my test environment. I can't find the correct method to stub.

Example test:

class ProductsControllerTest < ActionDispatch::IntegrationTest
  test "should get index" do
    get root_url
    assert_response :success
  end
end

Test result:

Failure: ProductsControllerTest#test_should_get_index [/shopify_stock_exporter/test/controllers/products_controller_test.rb:7]: Expected response to be a <2XX: success>, but was a <302: Found> redirect to http://ift.tt/1bZ4RUk

How can I have my test succeed?

Aucun commentaire:

Enregistrer un commentaire