Sha256: 7cc8e3e519e27672291cea58cc06a64054a0afc07db45fb2b2702ca844bce574

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'
include SContainer

describe Subtitle do
  before(:each) do
    @title = "127 Hours 2010 DVDSCR XViD-MC8"
    @new_file = "/tmp/#{@title.gsub(/\s+/, '.')}.zip"
    
    @subtitle = Subtitle.new({
      :details => "http://www.undertexter.se/23984/",
      :downloads => 100,
      :cds => 1,
      :title => @title,
      :movie_title => "127 Hours (127 Timmar)",
      :language => :swedish
    })
    
    WebMock.allow_net_connect!
  end
  
  it "should be an instance of subtitle" do
    @subtitle.should be_instance_of(Subtitle)
  end
  
  it "should have the right accessors" do
    @subtitle.details.should eq("http://www.undertexter.se/23984/")
    @subtitle.downloads.should eq(100)
    @subtitle.cds.should eq(1)
    @subtitle.title.should eq("127 Hours 2010 DVDSCR XViD-MC8")
    @subtitle.movie_title.should eq("127 Hours (127 Timmar)")
    @subtitle.url.should eq("http://undertexter.se/laddatext.php?id=23984")
  end
  
  it "should be able to download the subtitle" do
    @subtitle.download!.should eq(@new_file)
  end
  
  it "should have created an existing file" do
    FileUtils.rm(@new_file) if File.exists?(@new_file)
    @subtitle.download!
    File.exists?(@new_file).should be_true
  end
  
  it "should be able to download the file to a specific absolute directory" do
    %x{rm -r /tmp/new_dir; mkdir /tmp/new_dir}
    @subtitle.download!(:to => '/tmp/new_dir')
    %x{ls /tmp/new_dir}.should_not be_empty
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
undertexter-0.1.12 spec/subtitle_spec.rb
undertexter-0.1.11 spec/subtitle_spec.rb
undertexter-0.1.10 spec/subtitle_spec.rb
undertexter-0.1.9 spec/subtitle_spec.rb