Sha256: 85fffd2a611318141d0439c24052cfc15b390c326ec5416d64fe7cecd58d0357

Contents?: true

Size: 874 Bytes

Versions: 9

Compression:

Stored size: 874 Bytes

Contents

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

  before(:each) do
    @format  = Ppl::Format::Contact::PhoneNumber.new
    @contact = Ppl::Entity::Contact.new
    @color   = double(Ppl::Adapter::Color)
    @format.color_adapter = @color
  end

  describe "#process" do

    it "should return an empty string if the contact lacks a phone number" do
      @format.process(Ppl::Entity::Contact.new).should eq ""
    end

    it "should return the contact's phone number if it is set" do
      @contact.phone_numbers.push("0123456789")
      @format.process(@contact).should eq "0123456789"
    end

    it "should colorize the string if configured to do so" do
      @format.colors = { "phone_numbers" => "blue" }
      @color.should_receive(:colorize).and_return("phone numbers in blue")
      @format.process(@contact).should eq "phone numbers in blue"
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

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