Sha256: 1bcdb5af5f23e9b0e8d0eb9471b760ce030f53d9fc4b42b37c3c88dbefa5c27d

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

require_relative "../../../test_helper"

module Troo
  describe ListPresenter do
    let(:described_class) { ListPresenter }
    let(:options) { { } }

    before do
      @list = Fabricate(:list)
      @board = Fabricate(:board)
      @card = Fabricate(:card)
    end

    after { database_cleanup }

    describe "#initialize" do
      subject { described_class.new(@list, options) }

      it "assigns the list to an instance variable" do
        subject.instance_variable_get("@list").must_equal(@list)
      end

      it "assigns the options to an instance variable" do
        subject.instance_variable_get("@options").must_equal(options)
      end
    end

    describe "#render_show" do
      subject { capture_io { described_class.new(@list, options).render_show }.join }

      context "when the list has cards" do
        it "renders the view" do
          subject.must_match /My Test Board/
          subject.must_match /My Test List/
          subject.must_match /My Test Card/
        end
      end

      context "when the list has no cards" do
        before { @card.delete }

        it "returns a polite message" do
          subject.must_match /No cards were found./
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troo-0.0.4 test/lib/troo/display/list_presenter_test.rb
troo-0.0.3 test/lib/troo/display/list_presenter_test.rb
troo-0.0.2 test/lib/troo/display/list_presenter_test.rb