saasbook

movie_spec.3.rb

Sep 15th, 2014
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.54 KB | None | 0 0
  1. require 'spec_helper'
  2.  
  3. describe Movie do
  4.   describe 'searching Tmdb by keyword' do
  5.     it 'should call Tmdb with title keywords given valid API key' do
  6.       Tmdb::Movie.should_receive(:find).with('Inception')
  7.       Movie.find_in_tmdb('Inception')
  8.     end
  9.     it 'should raise an InvalidKeyError with no API key' do
  10.       Tmdb::Movie.stub(:find).and_raise(NoMethodError)
  11.       Tmdb::Api.stub(:response).and_return({'code' => 401})
  12.       lambda { Movie.find_in_tmdb('Inception') }.
  13.         should raise_error(Movie::InvalidKeyError)
  14.     end
  15.   end
  16. end
Add Comment
Please, Sign In to add comment