Sha256: 8b4af651a38a81355f7b372cd06deace26112bc5016d23c50c548cd8490beeda

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

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

module Troo
  module Remote
    module Persistence
      describe List do
        let(:described_class)   { List }
        let(:external_board_id) { '526d8e130a14a9d846001d96' }
        let(:resource_name)     { 'My New List' }
        let(:list) do
          [Fabricate.build(:list, name: resource_name)]
        end

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

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

          after  { VCR.eject_cassette }

          subject { described_class.with(@board, resource_name) }

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

          context 'when the list 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.9 test/lib/troo/remote/persistence/list_test.rb