Sha256: 19b084c118b62173ccfa61c3bddeed74f40b7a1ea17b9234c0e1440e73a94de1

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

require "spec_helper"

describe BtjunkieContainer::Torrent do
  before(:each) do
    @torrent = {
      :torrent => "http://dl.btjunkie.org/torrent/Joanna-2010-DVDRiP-XviD-DvF/43588d77f182c5c280c596f3c68c90357bbdfad7ea84/download.torrent",
      :details => "/torrent/Joanna-2010-DVDRiP-XviD-DvF/43588d77f182c5c280c596f3c68c90357bbdfad7ea84",
      :title   => "Joanna 2010 DVDRiP XviD-DvF",
      :seeders => "123"
    }
  end
  
  describe "Torrent#valid?" do
    it "should have a valid torrent" do
      BtjunkieContainer::Torrent.new(@torrent).should be_valid
    end
    
    it "should not be valid due to empty id" do
      BtjunkieContainer::Torrent.new(@torrent.merge(:torrent => "http://google.com")).should_not be_valid
    end
    
    it "should not be valid due to bad seeder param" do
      BtjunkieContainer::Torrent.new(@torrent.merge(:seeders => "abc")).should_not be_valid
    end
    
    it "should not be valid due to empty title" do
      BtjunkieContainer::Torrent.new(@torrent.merge(:title => "")).should_not be_valid
      BtjunkieContainer::Torrent.new(@torrent.merge(:title => nil)).should_not be_valid
    end
    
    it "should not be valid due to invalid torrent url" do
      BtjunkieContainer::Torrent.new(@torrent.merge(:torrent => "http://dl.btjunkie.org/torrent/Joanna-2010-DVDRiP-XviD-DvF/43588d77f182c5c280c596f3c68c90357bbdfad7ea84/download")).should_not be_valid
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
btjunkie-0.0.3 spec/torrent_spec.rb
btjunkie-0.0.2 spec/torrent_spec.rb