Sha256: bd945a9489db29835474288e5e8e1d22cb2ebbf531d28cf03a449669d24f53c6

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

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

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

    before do
      @card = Fabricate(:card)
      @comment = Fabricate(:comment)
      @member = Fabricate(:member)
    end

    after { database_cleanup }

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

      it "assigns the card to an instance variable" do
        subject.instance_variable_get("@card").must_equal(@card)
      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.render_show(@card, options) }.join }

      context "when the card has comments" do
        it "renders the view" do
          subject.must_match /My Test Card/
          subject.must_match /My Test Comment/
        end
      end

      context "when the card has no comments" do
        before { @comment.delete }

        it "returns a polite message" do
          subject.must_match /No comments 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/comment_presenter_test.rb
troo-0.0.3 test/lib/troo/display/comment_presenter_test.rb
troo-0.0.2 test/lib/troo/display/comment_presenter_test.rb