Skip to content

Commit

Permalink
complete controller spec for search_tmdb
Browse files Browse the repository at this point in the history
  • Loading branch information
armandofox committed Oct 1, 2011
1 parent 9b3e37e commit 1d8b4f6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions spec/controllers/movies_controller_spec.rb
Expand Up @@ -3,21 +3,22 @@
describe MoviesController do
describe 'searching TMDb' do
before :each do
Movie.stub(:find_in_tmdb).and_return('matching movies')
end
@fake_results = [mock('Movie'), mock('Movie')]
end
it 'should call the model method that performs TMDb search' do
Movie.should_receive(:find_in_tmdb).with('hardware')
Movie.should_receive(:find_in_tmdb).with('hardware').
and_return(@fake_results)
post :search_tmdb, {:search_terms => 'hardware'}
end
it 'should select the Search Results template for rendering' do
Movie.stub(:find_in_tmdb).and_return(@fake_results)
post :search_tmdb, {:search_terms => 'hardware'}
response.should render_template('search_tmdb')
end
it 'should make the TMDb search results available to that template' do
fake_results = [mock_model('Movie'), mock_model('Movie')]
Movie.stub(:find_in_tmdb).and_return(fake_results)
post :search_tmdb, :search_string => 'hardware'
assigns(:movies).should == fake_results
Movie.stub(:find_in_tmdb).and_return(@fake_results)
post :search_tmdb, {:search_terms => 'hardware'}
assigns(:movies).should == @fake_results
end
end
end

0 comments on commit 1d8b4f6

Please sign in to comment.