Sha256: 28042e987c1350b360fe0fbb99d0ecd1e33c890a5278fc787647682ee5ec7df6

Contents?: true

Size: 776 Bytes

Versions: 4

Compression:

Stored size: 776 Bytes

Contents

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

module Troo
  module Persistence
    describe Local do
      let(:described_class) { Local }
      let(:resources)       { [] }
      let(:resource)        { stub }

      before { resource.stubs(:preprocess).returns(resource) }

      describe '.with_collection' do
        subject { described_class.with_collection(resources) }

        context 'when the collection is empty' do
          it 'returns the empty collection' do
            subject.must_equal []
          end
        end

        context 'when the collection is not empty' do
          let(:resources) { [resource] }

          it 'returns the last persisted resource' do
            subject.must_equal [resource]
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
troo-0.0.12 test/lib/troo/persistence/local_test.rb
troo-0.0.11 test/lib/troo/persistence/local_test.rb
troo-0.0.10 test/lib/troo/persistence/local_test.rb
troo-0.0.9 test/lib/troo/persistence/local_test.rb