Sha256: bd276d67f95be5346cf23a847c4c9715cab710ed21ee08a14ae359347f194f7e

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe TrelloCli::CLI::Run do

  before do
    @card_mock = mock 'card'
    TrelloCli::CLI::Card.stub :new => @card_mock
  end

  it "should call the given target with sub command" do
    ARGV.should_receive(:shift).and_return('card')
    ARGV.should_receive(:shift).and_return('create')

    @card_mock.stub :actions => [:create]
    @card_mock.should_receive(:create)
    cli = TrelloCli::CLI::Run.new
    cli.run
  end

  it "should call help if the command does not exist" do
    ARGV.should_receive(:shift).and_return('card')
    ARGV.should_receive(:shift).and_return('bad_cmd')

    @card_mock.stub :actions => [:create]
    @card_mock.should_receive(:help)
    cli = TrelloCli::CLI::Run.new
    cli.run
  end

  it "should display help if the target does not exist" do
    ARGV.should_receive(:shift).and_return('bad_target')
    ARGV.should_receive(:shift).and_return('create')

    cli = TrelloCli::CLI::Run.new
    cli.should_receive(:puts).with "Unkown target: 'bad_target'."
    cli.should_receive(:puts).with "trello [board|card|list] [command] OPTIONS"
    cli.should_receive(:puts).with "Append -h for help on specific target."
    cli.run
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trello_cli-0.0.1 spec/cli/run_spec.rb