Sha256: e93618243ef483cc4d33a9b8873306e95ca9b0cc8b0ebff1f2d04da000a4e99a

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 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)             {
          [Fabricate.build(:card, name: resource_name,
                                  desc: description)]
        }

        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

5 entries across 5 versions & 1 rubygems

Version Path
troo-0.0.15 test/lib/troo/remote/persistence/card_test.rb
troo-0.0.14 test/lib/troo/remote/persistence/card_test.rb
troo-0.0.13 test/lib/troo/remote/persistence/card_test.rb
troo-0.0.12 test/lib/troo/remote/persistence/card_test.rb
troo-0.0.11 test/lib/troo/remote/persistence/card_test.rb