Sha256: 4636ecd0a1f63818aa5cfd4cd03df020f9bb458a867ef704eada761d80311e14

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

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

describe "Imdb::Search with multiple search results" do
  
  before(:each) do
    @search = Imdb::Search.new("Star Trek")
  end

  it "should remember the query" do
    @search.query.should == "Star Trek"
  end
  
  it "should find > 10 results" do
    @search.movies.size.should > 10
  end
  
  it "should return Imdb::Movie objects only" do
    @search.movies.each { |movie| movie.should be_an(Imdb::Movie) }
  end
  
  it "should not return movies with no title" do
    @search.movies.each { |movie| movie.title.should_not be_blank }
  end
  
end

describe "Imdb::Search with an exact match and no poster" do
  
  it "should not raise an exception" do
    lambda {
      @search = Imdb::Search.new("Kannethirey Thondrinal").movies
    }.should_not raise_error
  end
  
  it "should return the movie id correctly" do
    @search = Imdb::Search.new("Kannethirey Thondrinal")
    @search.movies.first.id.should eql("0330508")
  end
  
end

describe "Imdb::Search with an exact match" do
  
  before(:each) do
    @search = Imdb::Search.new("Matrix Revolutions")
  end
  
  it "should find one result" do
    @search.movies.size.should eql(1)
  end
  
  it "should have the corrected title" do
    @search.movies.first.title.should =~ /The Matrix Revolutions/i
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
imdb-0.6.5 spec/imdb/search_spec.rb
imdb-0.6.4 spec/imdb/search_spec.rb
imdb-0.6.3 spec/imdb/search_spec.rb
imdb-0.6.2 spec/imdb/search_spec.rb
imdb-0.6.1 spec/imdb/search_spec.rb
imdb-0.6.0 spec/imdb/search_spec.rb