require 'spec_helper' RSpec.describe 'Relation registration DSL' do include_context 'container' include_context 'users and tasks' it 'allows to expose chainable relations' do configuration.relation(:tasks) do def high_priority restrict { |tuple| tuple[:priority] < 2 } end def by_title(title) restrict(title: title) end end configuration.relation(:users) do def with_tasks join(tasks) end end tasks = container.relations.tasks expect(tasks.class.name).to eql("ROM::Relation[Tasks]") expect(tasks.high_priority.inspect).to include("#