Advertisement
saasbook

movies_controller_spec.7.rb

Jan 10th, 2012
755
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.84 KB | None | 0 0
  1. require 'spec_helper'
  2.  
  3. describe MoviesController do
  4.   describe 'searching TMDb' do
  5.     before :each do
  6.       @fake_results = [mock('Movie'), mock('Movie')]
  7.     end
  8.     it 'should call the model method that performs TMDb search' do
  9.       Movie.should_receive(:find_in_tmdb).with('hardware').
  10.         and_return(@fake_results)
  11.       post :search_tmdb, {:search_terms => 'hardware'}
  12.     end
  13.     describe 'after valid search' do
  14.       before :each do
  15.         Movie.stub(:find_in_tmdb).and_return(@fake_results)
  16.         post :search_tmdb, {:search_terms => 'hardware'}
  17.       end
  18.       it 'should select the Search Results template for rendering' do
  19.         response.should render_template('search_tmdb')
  20.       end
  21.       it 'should make the TMDb search results available to that template' do
  22.         assigns(:movies).should == @fake_results
  23.       end
  24.     end
  25.   end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement