Sha256: 69b2926401776beac62c6a229efcac27ef8bfb9195a8e4a59f5c03f25f44a047

Contents?: true

Size: 577 Bytes

Versions: 3

Compression:

Stored size: 577 Bytes

Contents

RSpec.shared_context 'relations' do
  let(:users) { rom.relation(:users) }
  let(:tasks) { rom.relation(:tasks) }
  let(:tags) { rom.relation(:tags) }

  before do
    configuration.relation(:users) do
      def all
        select(:id, :name).order(:name, :id)
      end

      def find(criteria)
        where(criteria)
      end
    end

    configuration.relation(:tasks) do
      def find(criteria)
        where(criteria)
      end

      def for_users(users)
        where(user_id: users.map { |u| u[:id] })
      end
    end

    configuration.relation(:tags)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rom-repository-0.2.0 spec/shared/relations.rb
rom-repository-0.2.0.rc1 spec/shared/relations.rb
rom-repository-0.2.0.beta1 spec/shared/relations.rb