Skip to content

Instantly share code, notes, and snippets.

@MaryKuz
Created March 28, 2019 10:10
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/ccdb01c52a0687612e2873784de1fb4b to your computer and use it in GitHub Desktop.
Save MaryKuz/ccdb01c52a0687612e2873784de1fb4b to your computer and use it in GitHub Desktop.
Correct the tests
describe '.search_by' do
let(:relation) { double }
before { expect(Product).to receive(:page).with(1).and_return(relation) }
context do
it { expect { Product.search_by 'page' => 1 }.to_not raise_error }
end
context do
before { expect(relation).to receive(:where).with('name ILIKE ?', 'abc%') }
it { expect { Product.search_by 'page' => 1, 'term' => 'abc' }.to_not raise_error }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment