Sha256: 777200f8e30225f0f01de38629aaceb381c31f35acd4f183aa7202f5423be8dc

Contents?: true

Size: 1.61 KB

Versions: 7

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'

describe Array do
  before(:each) do
    @subtitles = Undertexter.find("tt0840361")
  end
  
  it "should have a based_on method" do
    lambda{
      @subtitles.based_on("some args")
    }.should_not raise_error(NoMethodError)
  end
  
  it "should return the right one" do
    @subtitles.based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS").details.should match(/id=23752/)
  end
  
  it "should not return anything if the limit is set to low" do
    @subtitles.based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS", :limit => 0).should be_nil
  end
  
  it "should not return the right movie if to litle info i passed" do
    @subtitles.based_on("The Town").should be_nil
  end
  
  it "should return the right instance" do
    @subtitles.based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS").should be_instance_of(Subtitle)
  end
  
  it "should return nil if trying to fetch an non existing imdb id" do
    Undertexter.find("tt123456789").based_on("some random argument").should be_nil
  end
  
  it "should raise an exception when the array does not contain any subtitle objects" do
    lambda {
      [1,2,2,3].based_on("some args")
    }.should raise_error(NoMethodError)
  end
  
  it "should be an array" do
    @subtitles.should be_an_instance_of(Array)
  end
  
  it "should return nil due to the release date {S09E12}" do
    Undertexter.find("tt0313043").based_on("CSI.Miami.S09E12.HDTV.XviD-LOL").should be_nil
  end
  
  it "should not return anything due to the wrong year" do
    @subtitles.based_on("The Town EXTENDED 1999 480p BRRip XviD AC3 FLAWL3SS").should be_nil
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
undertexter-0.1.8 spec/array_spec.rb
undertexter-0.1.7 spec/array_spec.rb
undertexter-0.1.6 spec/array_spec.rb
undertexter-0.1.5 spec/array_spec.rb
undertexter-0.1.4 spec/array_spec.rb
undertexter-0.1.3 spec/array_spec.rb
undertexter-0.1.2 spec/array_spec.rb