spec/shared/users_and_tasks.rb in rom-http-0.1.2 vs spec/shared/users_and_tasks.rb in rom-http-0.2.0.beta1
- old
+ new
@@ -1,10 +1,26 @@
RSpec.shared_context 'users and tasks' do
include_context 'setup'
+ let(:users_relation) do
+ Class.new(ROM::HTTP::Relation) do
+ dataset :users
- before do
- gateway = setup.default
+ def by_id(id)
+ with_params(id: id)
+ end
+ end
+ end
+ let(:tasks_relation) do
+ Class.new(ROM::HTTP::Relation) do
+ dataset :tasks
- gateway.dataset(:users)
- gateway.dataset(:tasks)
+ def by_id(id)
+ with_params(id: id)
+ end
+ end
+ end
+
+ before do
+ configuration.register_relation(users_relation)
+ configuration.register_relation(tasks_relation)
end
end