Sha256: 4c205b6a51f193265b2b2c3188c6acd84daa1f79fdddd493df3b564710ec37fe
Contents?: true
Size: 1.6 KB
Versions: 3
Compression:
Stored size: 1.6 KB
Contents
describe Ppl::Command::Phone do before(:each) do @command = Ppl::Command::Phone.new end describe "#name" do it "should be 'phone'" do @command.name.should eq "phone" end end describe "#execute" do before(:each) do @contact = Ppl::Entity::Contact.new @storage = double(Ppl::Adapter::Storage) @input = Ppl::Application::Input.new @input.arguments = ["jdoe", "01234567"] @storage.stub(:require_contact).and_return(@contact) @storage.stub(:save_contact) @command.storage = @storage end it "should save phone numbers as instances of Ppl::Entity::PhoneNumber" do @storage.should_receive(:save_contact) do |c| c.phone_numbers.first.should be_a(Ppl::Entity::PhoneNumber) end @command.execute(@input, @output) end it "should save the given number as an attribute of the PhoneNumber" do @storage.should_receive(:save_contact) do |c| c.phone_numbers.first.number.should eq "01234567" end @command.execute(@input, @output) end it "should save the given type alongside the number" do @input.options[:type] = "cell" @storage.should_receive(:save_contact) do |c| c.phone_numbers.first.type.should eq "cell" end @command.execute(@input, @output) end it "shouldn't duplicate the number if the contact already has it" do @contact.phone_numbers << Ppl::Entity::PhoneNumber.new("01234567") @storage.should_receive(:save_contact) do |c| c.phone_numbers.length.should eq 1 end @command.execute(@input, @output) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ppl-1.22.1 | spec/ppl/command/phone_spec.rb |
ppl-1.22.0 | spec/ppl/command/phone_spec.rb |
ppl-1.21.0 | spec/ppl/command/phone_spec.rb |