Sha256: ace1a2a254bfd275b46ae4b32f7b092553b56e08de5bf88243850b58f9ea0cea

Contents?: true

Size: 945 Bytes

Versions: 27

Compression:

Stored size: 945 Bytes

Contents

describe Ppl::Format::Contact::Age do

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

  describe "#process" do

    it "should return an empty string if the contact lacks a birth date" do
      @color.stub(:colorize)
      @contact.should_receive(:age).and_return(nil)
      @format.process(@contact).should eq ""
    end

    it "should return the contact's age if the birthdate is known" do
      @contact.should_receive(:age).and_return(10)
      @format.process(@contact).should eq "10"
    end

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

  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

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