Sha256: 0b9ffed99d26459948f95a3d3bffd0a393c9b265e90267f28a0a8d343d53efa7

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 KB

Contents

describe Ppl::Format::AddressBook::PhoneNumbers 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, :phone_numbers], colors)
      format = Ppl::Format::AddressBook::PhoneNumbers.new(colors)
    end
  end
end

describe Ppl::Format::AddressBook::PhoneNumbers do

  before(:each) do
    @format       = Ppl::Format::AddressBook::PhoneNumbers.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:",
        :phone_numbers => "",
      })
      @format.process(@address_book)
    end

    it "should show the phone number if it's available" do
      @contact.phone_numbers.push("01234567890")
      @table.should_receive(:add_row).with({
        :id            => "test:",
        :phone_numbers => "01234567890",
      })
      @format.process(@address_book)
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

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