Sha256: affde1bda935d24568702e97694fcd5eabf2fb3921edafa0050848877e39185d

Contents?: true

Size: 837 Bytes

Versions: 27

Compression:

Stored size: 837 Bytes

Contents

describe Ppl::Format::Contact::Nicknames do

  before(:each) do
    @format  = Ppl::Format::Contact::Nicknames.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 nickname" do
      @format.process(Ppl::Entity::Contact.new).should eq ""
    end

    it "should return the contact's nickname if one is set" do
      @contact.nicknames.push("Dopey")
      @format.process(@contact).should eq "Dopey"
    end

    it "should colorize the string if configured to do so" do
      @format.colors = { "nicknames" => "blue" }
      @color.should_receive(:colorize).and_return("nicknames in blue")
      @format.process(@contact).should eq "nicknames 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/nicknames_spec.rb
ppl-3.0.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-2.4.1 spec/ppl/format/contact/nicknames_spec.rb
ppl-2.4.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-2.3.3 spec/ppl/format/contact/nicknames_spec.rb
ppl-2.3.2 spec/ppl/format/contact/nicknames_spec.rb
ppl-2.3.1 spec/ppl/format/contact/nicknames_spec.rb
ppl-2.3.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-2.2.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-2.1.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-2.0.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-1.25.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-1.24.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-1.23.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-1.22.2 spec/ppl/format/contact/nicknames_spec.rb
ppl-1.22.1 spec/ppl/format/contact/nicknames_spec.rb
ppl-1.22.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-1.21.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-1.20.0 spec/ppl/format/contact/nicknames_spec.rb
ppl-1.19.0 spec/ppl/format/contact/nicknames_spec.rb