Created
May 13, 2011 19:55
-
-
Save zeroeth/971204 to your computer and use it in GitHub Desktop.
cars_test.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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