Sha256: 7ab6e58e22608a564c266718fdbc3252f77bbc94271ad16acbc1d0496c8ce6bb

Contents?: true

Size: 897 Bytes

Versions: 52

Compression:

Stored size: 897 Bytes

Contents

describe Ppl::Command::Rm do

  before(:each) do
    @command = Ppl::Command::Rm.new
    @input   = Ppl::Application::Input.new
    @output  = Ppl::Application::Output.new(nil, nil)
    @contact = Ppl::Entity::Contact.new
    @storage = double(Ppl::Adapter::Storage)

    @input.arguments = ["test"]
    @command.storage = @storage
  end

  describe "#name" do
    it "should be 'rm'" do
      @command.name.should eq "rm"
    end
  end

  describe "#execute" do

    it "should raise an error if the contact isn't specified" do
      @input.arguments = [nil]
      expect{@command.execute(@input, @output)}.to raise_error(Ppl::Error::IncorrectUsage)
    end

    it "should delete the given contact" do
      @storage.should_receive(:require_contact).and_return(@contact)
      @storage.should_receive(:delete_contact).with(@contact)
      @command.execute(@input, @output)
    end

  end

end

Version data entries

52 entries across 52 versions & 1 rubygems

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