Created
August 4, 2009 22:29
-
-
Save thoughtbot/162347 to your computer and use it in GitHub Desktop.
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 HouseSearchTest < ActiveSupport::TestCase | |
should "produce only houses with the keyword in the description when sent #results for such a search" do | |
matching_house = Factory(:house, :description => 'foo') | |
nonmatching_house = Factory(:house, :description => 'bar') | |
results = HouseSearch.new('keyword' => 'fo').results | |
assert_all(results) {|house| house.description =~ /fo/} | |
end | |
should "produce only houses within the price range when sent #results for such a search" do | |
matching_house = Factory(:house, :price => 10) | |
nonmatching_house = Factory(:house, :price => 50) | |
results = HouseSearch.new('price' => '30-100').results | |
assert_all(results) {|house| 30 <= house.price && house.price <= 100} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment