Sha256: 683418813ce4ec9e18653073b20e8c90119f4e75d24f983df7f3eb4fc7501a63

Contents?: true

Size: 863 Bytes

Versions: 3

Compression:

Stored size: 863 Bytes

Contents

describe Ppl::Format::Contact::Birthday do

  before(:each) do
    @format  = Ppl::Format::Contact::Birthday.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 birthday" do
      expect(@format.process(Ppl::Entity::Contact.new)).to eq ""
    end

    it "should return the contact's birthday if it is set" do
      @contact.birthday = Date.parse("1970-01-01")
      expect(@format.process(@contact)).to eq "1970-01-01"
    end

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

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ppl-4.0.5 spec/ppl/format/contact/birthday_spec.rb
ppl-4.0.3 spec/ppl/format/contact/birthday_spec.rb
ppl-4.0.2 spec/ppl/format/contact/birthday_spec.rb