change for xhr to avoid csrf during testing

This commit is contained in:
Lucas Hiago
2020-06-20 10:28:29 -03:00
committed by Luis Ramos
parent 8f885dd1c5
commit 357c2c7b25

View File

@@ -148,16 +148,16 @@ describe EnterprisesController, type: :controller do
# let(:enterprise) { create(:enterprise, permalink: 'enterprise_permalink') }
it "responds with status of 200 when the route does not exist" do
spree_get :check_permalink, permalink: 'some_nonexistent_route', format: :js
xhr :get, :check_permalink, permalink: 'some_nonexistent_route', format: :js
expect(response.status).to be 200
end
it "responds with status of 409 when the permalink matches an existing route" do
# spree_get :check_permalink, { permalink: 'enterprise_permalink', format: :js }
# expect(response.status).to be 409
spree_get :check_permalink, permalink: 'map', format: :js
xhr :get, :check_permalink, permalink: 'map', format: :js
expect(response.status).to be 409
spree_get :check_permalink, permalink: '', format: :js
xhr :get, :check_permalink, permalink: '', format: :js
expect(response.status).to be 409
end
end