Created
August 4, 2009 22:29
-
-
Save thoughtbot/162345 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 HouseSearchesTest < ActionController::TestCase | |
should_route :get, '/house_searches', | |
:controller => :house_searches, | |
:action => :index | |
context "GET to index with houses" do | |
setup do | |
@houses = [Factory.stub(:house), Factory.stub(:house)] | |
@search = HouseSearch.new | |
HouseSearch.stubs(:new).returns(@search) | |
@search.stubs(:results).returns(@houses) | |
@params = 'the params' | |
get :index, :house_search => @params | |
end | |
should_render_template :index | |
should "assign the houses to @houses" do | |
assert_received(@search, :results) {|expects| expects.with()} | |
assert_equal @houses, assigns(:houses) | |
end | |
should "assign the house search to @house_search" do | |
assert_received(HouseSearch, :new) {|expects| expects.with(@params)} | |
assert_equal @search, assigns(:house_search) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment