Sha256: e1060b0e51b52ceeb43bbae307d463042e58f1ded16a31fd146c262af72a64d5

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

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

module Troo
  module Presenters
    describe List do
      let(:described_class) { List }
      let(:list)            { Fabricate(:list).decorator }
      let(:options)         { {} }

      let(:board)           { Fabricate(:board).decorator }
      let(:card)            { Fabricate(:card).decorator }
      let(:cards)           { [] }

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

      after { database_cleanup }

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

        it 'renders the board title for the list' do
          subject.must_match(/My Test Board/)
        end

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

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

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

        context 'when the list has no cards' do
          it 'returns a polite message' do
            subject.must_match(/No cards 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/list_test.rb