Sha256: 9635ea3703f00652cd19357969f592ea59a801522519e9911d2ea4f90cd87818

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

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

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

        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

5 entries across 5 versions & 1 rubygems

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