Sha256: 001ccf60dd3c8ec38b3835afc0848eeb9fc1ddf40a6826880412f031f6360213

Contents?: true

Size: 923 Bytes

Versions: 3

Compression:

Stored size: 923 Bytes

Contents

require 'spec_helper'

describe TrelloCli::CLI::Board::List do
  board = Struct.new :attributes
  let!(:board1) { (board.new({ name: "board1", id: "1", closed: true })) }
  let!(:board2) { (board.new({ name: "board2", id: "2", closed: false })) }

  let(:trello_mock) { double "trello" }
  let(:options_mock) { double "trello" }

  before do
    allow(OptionParser).to receive(:new).and_return options_mock
    expect(options_mock).to receive(:parse!)
    allow(TrelloCli::Requests::ListBoards).to receive(:new).and_return trello_mock
    allow(trello_mock).to receive(:list).and_return [board1, board2]
  end

  it "should puts open boards" do
    expect(subject).to receive(:puts).with("board2 ( 2 )")
    subject.run
  end

  it "should puts all boards" do
    subject.instance_variable_set(:@options, { closed: true })
    expect(subject).to receive(:puts).with("board1 ( 1 )\nboard2 ( 2 )")
    subject.run
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trello_cli-0.5.0 spec/cli/board/list_spec.rb
trello_cli-0.4.1 spec/cli/board/list_spec.rb
trello_cli-0.4.0 spec/cli/board/list_spec.rb