ruby on rails - Products specs in admin panel spree -
i've got piece of specs code: https://gist.github.com/mpanasiewicz/9751c1de65e9920d8ad6d6f866ef0ae5 there problem because 302 code instead of 200 or 404(if sth went wrong). think 302 because redirects me.
require 'rails_helper' rspec.describe spree::admin::productscontroller, type: :controller describe 'get synchronize' stub_authorization! let!(:variant) { create(:variant) } 'updates @products pkb starpacks details' spree_get :synchronize, id: variant expect(response).to have_http_status(200) end 'returns record not found if product not exist' spree_get :synchronize, id: 0 expect(response).to have_http_status(404) end end end
i've got 'stub_authorization!' think doesn't work ideas wrong code? thanks!
i think have redirect_to
method in update
method. redirect responds 302
code. if want code 200
should use render
method instead redirect_to
, it's bad idea after update. in example works good. go ahead, , change 200
on 302
or:
expect(response).to redirect_to 'your_url'
Comments
Post a Comment