Sha256: 7c292aab96a3679c917aa034518305e59c5aa2ca7e6af018d613d93050a1e635

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

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

module Troo
  describe MoveCard do
    let(:described_class) { MoveCard }
    let(:id) { '526d8e130a14a9d846001d98' }

    before do
      @list = Fabricate(:list, external_list_id: id)
      @card = Fabricate(:card)
      Troo::External::Card.stubs(:fetch).returns(true)
    end

    after { database_cleanup }

    describe '.initialize' do
      subject { described_class.new(@card, @list) }

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

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

    describe '#perform' do
      before do
        VCR.insert_cassette(:move_card,
                            decode_compressed_response: true)
      end

      after { VCR.eject_cassette }

      subject { described_class.with(@card, @list) }

      context 'when the card was moved' do
        it 'returns a refresh of all cards for the board' do
          subject.wont_equal false
        end
      end

      context 'when the card was not moved' do
        before do
          Trello::Card.any_instance.stubs(:move_to_list)
            .raises(Trello::Error)
        end

        it { subject.must_equal false }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 test/lib/troo/actions/move_card_test.rb