Sha256: e7ea529c8a0f7d7f6b4c5fa462bc7cd27f610634723dee3954eab562b5bd3b0d

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

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

module Troo
  describe CreateBoard do
    let(:described_class) { CreateBoard }
    let(:board_name)      { "My New Board" }
    let(:description)     { "A very brief description..." }

    before do
      @board = Fabricate(:board, name: board_name, description: description)
      BoardPersistence.stubs(:for).returns(@board)
    end

    after { database_cleanup }

    describe ".initialize" do
      subject { described_class.new(board_name, description) }

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

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

    describe ".with" do
      before { VCR.insert_cassette(:create_board, decode_compressed_response: true) }
      after  { VCR.eject_cassette }

      subject { described_class.with(board_name, description) }

      context "when the board was created" do
        it "returns the new board" do
          subject.must_equal(@board)
        end
      end

      context "when the board was not created" do
        before { Trello::Board.stubs(:create).raises(Trello::Error) }

        it { subject.must_equal false }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troo-0.0.7 test/lib/troo/actions/create_board_test.rb
troo-0.0.6 test/lib/troo/actions/create_board_test.rb
troo-0.0.5 test/lib/troo/actions/create_board_test.rb