Sha256: 870ebffefbe788ada239c3bba6a04c632a5cae0c2cd7b523d89b4141d9acb960

Contents?: true

Size: 1022 Bytes

Versions: 52

Compression:

Stored size: 1022 Bytes

Contents

describe Ppl::Command::Show do

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

    @command.storage = @storage
    @command.format  = @format
  end

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

  describe "#execute" do

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

    it "should show the contact's name" do
      @storage.should_receive(:require_contact).and_return(@contact)
      @format.should_receive(:process).and_return("John Doe")

      @input.arguments = ["john"]

      @output.should_receive(:line).with("John Doe")
      @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/show_spec.rb
ppl-1.17.2 spec/ppl/command/show_spec.rb
ppl-1.17.1 spec/ppl/command/show_spec.rb
ppl-1.17.0 spec/ppl/command/show_spec.rb
ppl-1.16.0 spec/ppl/command/show_spec.rb
ppl-1.15.1 spec/ppl/command/show_spec.rb
ppl-1.15.0 spec/ppl/command/show_spec.rb
ppl-1.14.1 spec/ppl/command/show_spec.rb
ppl-1.14.0 spec/ppl/command/show_spec.rb
ppl-1.13.0 spec/ppl/command/show_spec.rb
ppl-1.12.0 spec/ppl/command/show_spec.rb
ppl-1.11.0 spec/ppl/command/show_spec.rb
ppl-1.10.0 spec/ppl/command/show_spec.rb
ppl-1.9.0 spec/ppl/command/show_spec.rb
ppl-1.8.0 spec/ppl/command/show_spec.rb
ppl-1.7.0 spec/ppl/command/show_spec.rb
ppl-1.6.0 spec/ppl/command/show_spec.rb
ppl-1.5.3 spec/ppl/command/show_spec.rb
ppl-1.5.2 spec/ppl/command/show_spec.rb
ppl-1.5.1 spec/ppl/command/show_spec.rb