Sha256: 6f7a41408e9ca4c6c296b5f069b0acca6185d1e3e8af7b13f3aa9e017a25210b

Contents?: true

Size: 1.9 KB

Versions: 3

Compression:

Stored size: 1.9 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

### WARNING: This spec uses live data!
#
# Many may object to testing against a live website, and for good reason. 
# However, the IMDB interface changes over time, and to guarantee the parser
# works with the currently available IMDB website, tests are run against
# IMDB.com instead.
#
# This test uses "Die hard (1988)" as a testing sample:
#   
#     http://www.imdb.com/title/tt0095016/
#

describe "Imdb::Movie" do
  
  before(:each) do
    # Get Die Hard (1988)
    @movie = Imdb::Movie.new("0095016")
  end
  
  it "should find the cast members" do
    cast = @movie.cast_members
    
    cast.should be_an(Array)
    cast.should include("Bruce Willis")
    cast.should include("Bonnie Bedelia")
    cast.should include("Alan Rickman")
  end
  
  it "should find the director" do
    @movie.director.should =~ /John McTiernan/
  end
  
  it "should find the genres" do
    genres = @movie.genres
    
    genres.should be_an(Array)
    genres.should include('Action')
    genres.should include('Crime')
    genres.should include('Drama')
    genres.should include('Thriller')
  end
  
  it "should find the length (in minutes)" do
    @movie.length.should eql(131)
  end
  
  it "should find the plot" do
    @movie.plot.should eql("New York cop John McClane gives terrorists a dose of their own medicine as they hold hostages in an LA office building.")
  end
  
  it "should find the poster" do
    @movie.poster.should eql("http://ia.media-imdb.com/images/M/MV5BMTIxNTY3NjM0OV5BMl5BanBnXkFtZTcwNzg5MzY0MQ@@.jpg")
  end
  
  it "should find the rating" do
    @movie.rating.should eql(8.3)
  end
  
  it "should find the title" do
    @movie.title.should =~ /Die Hard/
  end
  
  it "should find the tagline" do
    @movie.tagline.should =~ /It will blow you through the back wall of the theater/
  end
  
  it "should find the year" do
    @movie.year.should eql(1988)
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
imdb-0.0.1 spec/imdb_movie_spec.rb
imdb-0.2.0 spec/imdb_movie_spec.rb
imdb-0.1.0 spec/imdb_movie_spec.rb