Sha256: 885c7cdaf527013a7a0df970349fea449b104d42ace6a2dc90f79fef43f43b57

Contents?: true

Size: 1.15 KB

Versions: 27

Compression:

Stored size: 1.15 KB

Contents

describe Ppl::Format::AddressBook::Urls do
  describe "#initialize" do
    it "should pass the colors through to the table" do
      colors = {"id" => "blue"}
      Ppl::Format::Table.should_receive(:new).with([:id, :urls], colors)
      format = Ppl::Format::AddressBook::Urls.new(colors)
    end
  end
end

describe Ppl::Format::AddressBook::Urls do

  before(:each) do
    @format       = Ppl::Format::AddressBook::Urls.new
    @address_book = Ppl::Entity::AddressBook.new
    @contact      = Ppl::Entity::Contact.new
    @table        = double(Ppl::Format::Table)

    @contact.id = "test"
    @format.table = @table

    @address_book.contacts.push(@contact)
  end

  describe "#process" do

    it "should at least show the contact's id" do
      @table.should_receive(:add_row).with({
        :id   => "test:",
        :urls => "",
      })
      @format.process(@address_book)
    end

    it "should show a URL if it's available" do
      @contact.urls.push "http://example.org/~jdoe"
      @table.should_receive(:add_row).with({
        :id   => "test:",
        :urls => "http://example.org/~jdoe",
      })
      @format.process(@address_book)
    end

  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
ppl-1.18.0 spec/ppl/format/address_book/urls_spec.rb
ppl-1.17.2 spec/ppl/format/address_book/urls_spec.rb
ppl-1.17.1 spec/ppl/format/address_book/urls_spec.rb
ppl-1.17.0 spec/ppl/format/address_book/urls_spec.rb
ppl-1.16.0 spec/ppl/format/address_book/urls_spec.rb
ppl-1.15.1 spec/ppl/format/address_book/urls_spec.rb
ppl-1.15.0 spec/ppl/format/address_book/urls_spec.rb