Sha256: a1f131a5c43720ffaa43e49c941633958072128b6bfb283b980c6868f0350502

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

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

describe Ppl::Format::AddressBook::Nicknames do

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

    it "should show a nickname if it's available" do
      @contact.nicknames.push("Stupid")
      @table.should_receive(:add_row).with({
        :id        => "test:",
        :nicknames => "Stupid",
      })
      @format.process(@address_book)
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

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