Sha256: 7cae9b788c915813547e32b3a6c02ad42806d792f0e5b4411e49f0bfa51678cb

Contents?: true

Size: 1.18 KB

Versions: 27

Compression:

Stored size: 1.18 KB

Contents

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

describe Ppl::Format::AddressBook::Birthdays do

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

    it "should show the birthday if it's available" do
      @contact.birthday = Date.parse("2001-02-03")
      @table.should_receive(:add_row).with({
        :id        => "test:",
        :birthday  => "2001-02-03",
      })
      @format.process(@address_book)
    end

  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
ppl-3.0.1 spec/ppl/format/address_book/birthdays_spec.rb
ppl-3.0.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-2.4.1 spec/ppl/format/address_book/birthdays_spec.rb
ppl-2.4.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-2.3.3 spec/ppl/format/address_book/birthdays_spec.rb
ppl-2.3.2 spec/ppl/format/address_book/birthdays_spec.rb
ppl-2.3.1 spec/ppl/format/address_book/birthdays_spec.rb
ppl-2.3.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-2.2.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-2.1.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-2.0.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-1.25.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-1.24.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-1.23.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-1.22.2 spec/ppl/format/address_book/birthdays_spec.rb
ppl-1.22.1 spec/ppl/format/address_book/birthdays_spec.rb
ppl-1.22.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-1.21.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-1.20.0 spec/ppl/format/address_book/birthdays_spec.rb
ppl-1.19.0 spec/ppl/format/address_book/birthdays_spec.rb