Sha256: 6f7f4a2ce04046da5cadb04697d41fba4e9effe5a63eac5c25dc2bdc81c42a27

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

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

module Troo
  module Remote
    module Persistence
      describe Card do
        let(:described_class)  { Card }
        let(:external_list_id) { '20040' }
        let(:resource_name)    { 'My New Card' }
        let(:description)      { 'A description to get us started.' }
        let(:card) do
          [Fabricate.build(:card, name: resource_name,
                                  desc: description)]
        end

        before do
          Troo::Persistence::Local.stubs(:with_collection)
            .returns(card)
        end
        after  { database_cleanup }

        describe '.with' do
          before do
            VCR.insert_cassette(:create_card,
                                decode_compressed_response: true)
          end

          after  { VCR.eject_cassette }

          subject do
            described_class
              .with(external_list_id, resource_name, description)
          end

          context 'when the card was created' do
            it 'returns the new card' do
              subject.must_be_instance_of Troo::Card
            end
          end

          context 'when the card was not created' do
            before { API::Client.stubs(:perform).returns([]) }

            it { subject.must_equal false }
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.10 test/lib/troo/remote/persistence/card_test.rb