Sha256: aacd6156bbff1033b908e66fdfe01bb22f11cdc2b6fbaa3bc81918b9a6e4ae12

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require_relative '../../../test_helper'
require_relative '../../../../lib/vedeu/repository/repository'

module Vedeu
  class Dummy
    def name
      'dummy'
    end
  end

  class DummyRepository
    extend Repository

    def self.entity
      Dummy
    end
  end

  describe Repository do
    describe '#adaptor' do
      it 'returns a Storage' do
        DummyRepository.adaptor.must_be_instance_of(Storage)
      end
    end

    describe '#find' do
      it 'returns a Dummy' do
        dummy = DummyRepository.create(Dummy.new)
        DummyRepository.find(dummy.name).must_be_instance_of(Dummy)
      end
    end

    describe '#all' do
      it 'returns all the stored items' do
        DummyRepository.all.must_be_instance_of(Array)
      end
    end

    describe '#query' do
      it 'returns a Dummy' do
        dummy = DummyRepository.create(Dummy.new)
        DummyRepository.query(Dummy, :name, 'dummy').must_be_instance_of(Dummy)
      end
    end

    describe '#create' do
      it 'returns a Dummy' do
        dummy = DummyRepository.create(Dummy.new)
        DummyRepository.create(dummy).must_be_instance_of(Dummy)
      end
    end

    describe '#reset' do
      it 'returns an Array' do
        DummyRepository.reset.must_be_instance_of(Array)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.0.31 test/lib/vedeu/repository/repository_test.rb