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-1.18.0 spec/ppl/command/rm_spec.rb
ppl-1.17.2 spec/ppl/command/rm_spec.rb
ppl-1.17.1 spec/ppl/command/rm_spec.rb
ppl-1.17.0 spec/ppl/command/rm_spec.rb
ppl-1.16.0 spec/ppl/command/rm_spec.rb
ppl-1.15.1 spec/ppl/command/rm_spec.rb
ppl-1.15.0 spec/ppl/command/rm_spec.rb
ppl-1.14.1 spec/ppl/command/rm_spec.rb
ppl-1.14.0 spec/ppl/command/rm_spec.rb
ppl-1.13.0 spec/ppl/command/rm_spec.rb
ppl-1.12.0 spec/ppl/command/rm_spec.rb
ppl-1.11.0 spec/ppl/command/rm_spec.rb
ppl-1.10.0 spec/ppl/command/rm_spec.rb
ppl-1.9.0 spec/ppl/command/rm_spec.rb
ppl-1.8.0 spec/ppl/command/rm_spec.rb
ppl-1.7.0 spec/ppl/command/rm_spec.rb
ppl-1.6.0 spec/ppl/command/rm_spec.rb
ppl-1.5.3 spec/ppl/command/rm_spec.rb
ppl-1.5.2 spec/ppl/command/rm_spec.rb
ppl-1.5.1 spec/ppl/command/rm_spec.rb