Sha256: 0309d3fadc073184c18d0d8f5c5ee5e6bdd9e8fa1990849a2fbe2f49e3cb74ea

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 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("I killed my lesbian wife")
  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 =~ /I Killed My Lesbian Wife/i
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imdb-0.6.6 spec/imdb/search_spec.rb