Sha256: 6dc1ad6546296faad1961523ea80e23b53950decb1019831c14dd1e3989a0ea0

Contents?: true

Size: 1.18 KB

Versions: 13

Compression:

Stored size: 1.18 KB

Contents

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

describe Ppl::Format::Contact::EmailAddresses do

  before(:each) do
    @format  = Ppl::Format::Contact::EmailAddresses.new
    @contact = Ppl::Entity::Contact.new
    @email   = Ppl::Entity::EmailAddress.new("test@example.org")
    @table   = double(Ppl::Format::Table)
    @format.table = @table
    @contact.email_addresses << @email
  end

  describe "#process" do

    it "should pass each email address to the table" do
      @table.should_receive(:add_row).with({
        :star            => " ",
        :email_addresses => "test@example.org",
      })
      @format.process(@contact)
    end

    it "should mark the preferred email with a star" do
      @email.preferred = true
      @table.should_receive(:add_row).with({
        :star            => "*",
        :email_addresses => "test@example.org",
      })
      @format.process(@contact)
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ppl-3.0.1 spec/ppl/format/contact/email_addresses_spec.rb
ppl-3.0.0 spec/ppl/format/contact/email_addresses_spec.rb
ppl-2.4.1 spec/ppl/format/contact/email_addresses_spec.rb
ppl-2.4.0 spec/ppl/format/contact/email_addresses_spec.rb
ppl-2.3.3 spec/ppl/format/contact/email_addresses_spec.rb
ppl-2.3.2 spec/ppl/format/contact/email_addresses_spec.rb
ppl-2.3.1 spec/ppl/format/contact/email_addresses_spec.rb
ppl-2.3.0 spec/ppl/format/contact/email_addresses_spec.rb
ppl-2.2.0 spec/ppl/format/contact/email_addresses_spec.rb
ppl-2.1.0 spec/ppl/format/contact/email_addresses_spec.rb
ppl-2.0.0 spec/ppl/format/contact/email_addresses_spec.rb
ppl-1.25.0 spec/ppl/format/contact/email_addresses_spec.rb
ppl-1.24.0 spec/ppl/format/contact/email_addresses_spec.rb