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