Sha256: bb92a3c32dd413acfafc7ed55866b8509ddd64cd7f140d29a97af578228692b6

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

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

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

      let(:board)           { Fabricate(:board) }
      let(:card)            { Fabricate(:card) }
      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

6 entries across 6 versions & 1 rubygems

Version Path
troo-0.0.15 test/lib/troo/presenters/list_test.rb
troo-0.0.14 test/lib/troo/presenters/list_test.rb
troo-0.0.13 test/lib/troo/presenters/list_test.rb
troo-0.0.12 test/lib/troo/presenters/list_test.rb
troo-0.0.11 test/lib/troo/presenters/list_test.rb
troo-0.0.10 test/lib/troo/presenters/list_test.rb