Sha256: 97e2ef48086075a41de039aecdd48dabe58a4c1b251efb1be6c819d1083cc371

Contents?: true

Size: 1.59 KB

Versions: 17

Compression:

Stored size: 1.59 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Punchblock::URIList do
  its(:size) { should == 0 }

  context "created with a set of entries" do
    subject { described_class.new 'http://example.com/hello.mp3', 'http://example.com/goodbye.mp3' }

    its(:size) { should == 2 }
    its(:to_ary) { should == ['http://example.com/hello.mp3', 'http://example.com/goodbye.mp3'] }

    its(:to_s) { should == "http://example.com/hello.mp3\nhttp://example.com/goodbye.mp3" }
  end

  context "created with an array of entries" do
    subject { described_class.new ['http://example.com/hello.mp3', 'http://example.com/goodbye.mp3'] }

    its(:size) { should == 2 }
    its(:to_ary) { should == ['http://example.com/hello.mp3', 'http://example.com/goodbye.mp3'] }
    its(:to_s) { should == "http://example.com/hello.mp3\nhttp://example.com/goodbye.mp3" }
  end

  context "imported from a string" do
    let(:string) do
      <<-STRING
      http://example.com/hello.mp3
      http://example.com/goodbye.mp3
      STRING
    end

    subject { described_class.import string }

    its(:size) { should == 2 }
    its(:to_ary) { should == ['http://example.com/hello.mp3', 'http://example.com/goodbye.mp3'] }
    its(:to_s) { should == "http://example.com/hello.mp3\nhttp://example.com/goodbye.mp3" }
  end

  describe "comparisons" do
    context "when the elements are the same" do
      described_class.new('foo', 'bar').should == described_class.new('foo', 'bar')
    end

    context "when the elements are different" do
      described_class.new('foo', 'baz').should_not == described_class.new('bar', 'baz')
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
punchblock-2.5.2 spec/punchblock/uri_list_spec.rb
punchblock-2.5.1 spec/punchblock/uri_list_spec.rb
punchblock-2.5.0 spec/punchblock/uri_list_spec.rb
punchblock-2.4.2 spec/punchblock/uri_list_spec.rb
punchblock-2.4.0 spec/punchblock/uri_list_spec.rb
punchblock-2.3.1 spec/punchblock/uri_list_spec.rb
punchblock-2.3.0 spec/punchblock/uri_list_spec.rb
punchblock-2.2.2 spec/punchblock/uri_list_spec.rb
punchblock-2.2.1 spec/punchblock/uri_list_spec.rb
punchblock-2.2.0 spec/punchblock/uri_list_spec.rb
punchblock-2.1.1 spec/punchblock/uri_list_spec.rb
punchblock-2.1.0 spec/punchblock/uri_list_spec.rb
punchblock-2.0.2 spec/punchblock/uri_list_spec.rb
punchblock-2.0.1 spec/punchblock/uri_list_spec.rb
punchblock-2.0.0 spec/punchblock/uri_list_spec.rb
punchblock-2.0.0.beta2 spec/punchblock/uri_list_spec.rb
punchblock-2.0.0.beta1 spec/punchblock/uri_list_spec.rb