Sha256: 2671175b4dc9b20153c81dbb05d8690bb40ebea0efd2dfc28696b51e39aef575

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

require_relative '../../../test_helper'

module Troo
  module Presenters
    describe Board do
      let(:described_class) { Board }
      let(:board)           { Fabricate(:board).decorator }
      let(:options)         { {} }
      let(:lists)           { [] }
      let(:list)            { Fabricate(:list).decorator }
      let(:cards)           { [] }
      let(:card)            { Fabricate(:card).decorator }

      before do
        board.stubs(:lists).returns(lists)
        list.stubs(:cards).returns(cards)
      end

      after { database_cleanup }

      describe '#show' do
        subject do
          capture_io { described_class.new(board, options).show }.join
        end

        it 'renders the view' do
          subject.must_match(/My Test Board/)
        end

        context 'when the board has lists' do
          let(:lists) { [list] }

          it 'renders the view' do
            subject.must_match(/My Test List/)
          end

          context 'and the list has cards' do
            let(:cards) { [card] }

            it 'renders the view' do
              subject.must_match(/My Test Card/)
            end
          end

          context 'and the list has no cards' do
            it 'returns a polite message' do
              subject.must_match(/No cards were found./)
            end
          end
        end

        context 'when the board has no lists' do
          it 'returns a polite message' do
            subject.must_match(/No lists were found./)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.9 test/lib/troo/presenters/board_test.rb