Sha256: 2a434ac0e439a298a1200010107e4dc4ab5b36e8dec7dac0e33a52dcdd73365d

Contents?: true

Size: 1.69 KB

Versions: 5

Compression:

Stored size: 1.69 KB

Contents

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

module Vedeu
  describe Storage do
    let(:described_class) { Storage }
    let(:subject)         { described_class.new }
    let(:record)          { DummyCommand.new }
    let(:entity)           {}

    it 'returns a Storage instance' do
      subject.must_be_instance_of(Storage)
    end

    it 'sets an instance variable' do
      subject.instance_variable_get('@map').must_equal({})
    end

    describe '#create' do
      let(:subject) { described_class.new.create(record) }

      it 'returns the stored record' do
        subject.must_be_instance_of(DummyCommand)
      end
    end

    describe '#delete' do
      let(:subject) { described_class.new.delete(record) }

      it 'returns a NilClass' do
        subject.must_be_instance_of(NilClass)
      end
    end

    describe '#reset' do
      let(:subject) { described_class.new.reset(entity) }

      it 'returns an Array' do
        subject.must_be_instance_of(Array)
      end
    end

    describe '#find' do
      let(:subject)     { described_class.new.find(entity, record_name) }
      let(:record_name) { 'dummy' }

      it 'returns a NilClass' do
        subject.must_be_instance_of(NilClass)
      end
    end

    describe '#all' do
      let(:subject) { described_class.new.all(entity) }

      it 'returns an Array' do
        subject.must_be_instance_of(Array)
      end
    end

    describe '#query' do
      let(:subject)   { described_class.new.query(entity, attribute, value) }
      let(:attribute) {}
      let(:value)     {}

      context 'when the item cannot be found' do
        it 'returns a NilClass' do
          subject.must_be_instance_of(NilClass)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.0.25 test/lib/vedeu/repository/storage_test.rb
vedeu-0.0.24 test/lib/vedeu/repository/storage_test.rb
vedeu-0.0.23 test/lib/vedeu/repository/storage_test.rb
vedeu-0.0.22 test/lib/vedeu/repository/storage_test.rb
vedeu-0.0.21 test/lib/vedeu/repository/storage_test.rb