Skip to content

Instantly share code, notes, and snippets.

@MaryKuz
Created March 28, 2019 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaryKuz/6971c6c574593e29f0ee3db15e9066e6 to your computer and use it in GitHub Desktop.
Save MaryKuz/6971c6c574593e29f0ee3db15e9066e6 to your computer and use it in GitHub Desktop.
Correct spec/controllers/api/products_controller_spec.rb tests
RSpec.describe Api::ProductsController, type: :controller do
....
describe '#collection' do
before { expect(subject).to receive(:params).and_return(:params) }
before { expect(Product).to receive(:search_by).with(params) }
it { expect { subject.send :collection }.to_not raise_error }
end
....
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment