Skip to content

Instantly share code, notes, and snippets.

@thoughtbot
Created August 4, 2009 22:29
Show Gist options
  • Save thoughtbot/162346 to your computer and use it in GitHub Desktop.
Save thoughtbot/162346 to your computer and use it in GitHub Desktop.
class HouseSearchTest < ActiveSupport::TestCase
should "build a new HouseSearch with the expected params" do
params = {'keyword' => 'some keyword',
'price' => '20-30'}
house_search = HouseSearch.new(params)
params.each do |field, value|
assert_equal value, house_search.send(field)
end
end
should "handle nil on #new" do
assert_nothing_raised do
search = HouseSearch.new(nil)
end
end
should "produce nil on #id" do
search = HouseSearch.new
assert_nil search.id
end
should "produce true on #new_record?" do
search = HouseSearch.new
assert search.new_record?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment