Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Created May 13, 2011 19:55
Show Gist options
  • Select an option

  • Save zeroeth/971204 to your computer and use it in GitHub Desktop.

Select an option

Save zeroeth/971204 to your computer and use it in GitHub Desktop.
cars_test.rb
class CarsTest < ActionController::TestCase
indexes_tables :car
context "Car search" do
setup do
@car1 = Factory(:car, :make => "Alfi", :model => "Super")
@car2 = Factory(:car, :make => "Dan", :model => "English")
@car3 = Factory(:car, :make => "Alorus", :model => "Great")
end
should "find will" do
results = Car.search('Alfi')
assert results.include?(@car1)
assert results.include?(@car2)
assert ! results.include?(@car3)
end
should "find ignorance" do
assert_equal @car, User.search('Super').first
end
should "not find the drummer" do
assert_equal 0, Car.search('No dice').size
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment