Sha256: 30b39badc46035c0bbac2e7c8be8d9c4bb173b00a5470d7d7c51627cd7cdbbc9

Contents?: true

Size: 968 Bytes

Versions: 2

Compression:

Stored size: 968 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 )")
    expect(subject).to receive(:puts).with("board2 ( 2 )")
    subject.run
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trello_cli-0.3.0 spec/cli/board/list_spec.rb
trello_cli-0.2.1 spec/cli/board/list_spec.rb