Sha256: 1de15adc8a57176ddca31a357ea2a1371e372e900e114e3de1d66e134811c770

Contents?: true

Size: 1.36 KB

Versions: 10

Compression:

Stored size: 1.36 KB

Contents

describe Ppl::Service::Name do

  before(:each) do
    @service = Ppl::Service::Name.new
    @name = Ppl::Entity::Name.new
  end

  describe "#parse" do

    it "uses the whole string for the full name" do
      @service.parse("John Smith").full.should eq "John Smith"
    end

    it "uses the first word for the given name" do
      @service.parse("John Smith").given.should eq "John"
    end

    it "uses the rest of the string for the family names" do
      @service.parse("John Fitzgerald Donald Smith").family.should eq "Fitzgerald Donald Smith"
    end

  end

  describe "#update" do

    it "updates the full name" do
      @service.update(@name, {:full => "Abc Def"})
      @name.full.should eq "Abc Def"
    end

    it "updates the given names" do
      @service.update(@name, {:given => "John"})
      @name.given.should eq "John"
    end

    it "updates the family names" do
      @service.update(@name, {:family => "Smith"})
      @name.family.should eq "Smith"
    end

    it "updates the middle names" do
      @service.update(@name, {:middle => "Arnold"})
      @name.middle.should eq "Arnold"
    end

    it "updates the name prefix" do
      @service.update(@name, {:prefix => "Mr"})
      @name.prefix.should eq "Mr"
    end

    it "updates the name suffix" do
      @service.update(@name, {:suffix => "BSc"})
      @name.suffix.should eq "BSc"
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ppl-3.0.1 spec/ppl/service/name_spec.rb
ppl-3.0.0 spec/ppl/service/name_spec.rb
ppl-2.4.1 spec/ppl/service/name_spec.rb
ppl-2.4.0 spec/ppl/service/name_spec.rb
ppl-2.3.3 spec/ppl/service/name_spec.rb
ppl-2.3.2 spec/ppl/service/name_spec.rb
ppl-2.3.1 spec/ppl/service/name_spec.rb
ppl-2.3.0 spec/ppl/service/name_spec.rb
ppl-2.2.0 spec/ppl/service/name_spec.rb
ppl-2.1.0 spec/ppl/service/name_spec.rb