Sha256: c17c41669fbb1cce61e96ced5529fdb7162432f8774f13edafdd971a5013756e

Contents?: true

Size: 1.45 KB

Versions: 13

Compression:

Stored size: 1.45 KB

Contents

describe Ppl::Format::Contact::PhoneNumber do

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

  describe "#process" do

    before(:each) do
      @contact = Ppl::Entity::Contact.new
      @number  = Ppl::Entity::PhoneNumber.new("01234567890")
      @format  = Ppl::Format::Contact::PhoneNumber.new
      @table   = double(Ppl::Format::Table)
      @format.table = @table
      @contact.phone_numbers << @number
    end

    it "should always include the phone number" do
      @table.should_receive(:add_row).with({
        :star          => " ",
        :phone_numbers => "01234567890",
        :type          => nil,
      })
      @format.process(@contact)
    end

    it "should put the type in parentheses" do
      @number.type = "work"
      @table.should_receive(:add_row).with({
        :star          => " ",
        :phone_numbers => "01234567890",
        :type          => "(work)",
      })
      @format.process(@contact)
    end

    it "should mark preferred numbers with a star" do
      @number.preferred = true
      @table.should_receive(:add_row).with({
        :star          => "*",
        :phone_numbers => "01234567890",
        :type          => nil,
      })
      @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/phone_number_spec.rb
ppl-3.0.0 spec/ppl/format/contact/phone_number_spec.rb
ppl-2.4.1 spec/ppl/format/contact/phone_number_spec.rb
ppl-2.4.0 spec/ppl/format/contact/phone_number_spec.rb
ppl-2.3.3 spec/ppl/format/contact/phone_number_spec.rb
ppl-2.3.2 spec/ppl/format/contact/phone_number_spec.rb
ppl-2.3.1 spec/ppl/format/contact/phone_number_spec.rb
ppl-2.3.0 spec/ppl/format/contact/phone_number_spec.rb
ppl-2.2.0 spec/ppl/format/contact/phone_number_spec.rb
ppl-2.1.0 spec/ppl/format/contact/phone_number_spec.rb
ppl-2.0.0 spec/ppl/format/contact/phone_number_spec.rb
ppl-1.25.0 spec/ppl/format/contact/phone_number_spec.rb
ppl-1.24.0 spec/ppl/format/contact/phone_number_spec.rb