Sha256: d40a227faa8d37f7909a662684df3cf8cd24b7a22cd7652ee11deb1ac9f5dcbc

Contents?: true

Size: 936 Bytes

Versions: 3

Compression:

Stored size: 936 Bytes

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" 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

3 entries across 3 versions & 2 rubygems

Version Path
cschiewek-imdb-0.5.1 spec/imdb/search_spec.rb
imdb-0.5.1 spec/imdb/search_spec.rb
imdb-0.5.0 spec/imdb/search_spec.rb