spec/integration/repository_spec.rb in rom-repository-0.1.0 vs spec/integration/repository_spec.rb in rom-repository-0.2.0.beta1
- old
+ new
@@ -3,30 +3,34 @@
include_context 'relations'
include_context 'seeds'
include_context 'structs'
it 'loads a single relation' do
- expect(repo.all_users.to_a).to eql([jane, joe])
+ expect(repo.all_users.to_a).to match_array([jane, joe])
end
+ it 'loads a relation by an association' do
+ expect(repo.tasks_for_users(repo.all_users)).to match_array([jane_task, joe_task])
+ end
+
it 'loads a combine relation with one parent' do
expect(repo.task_with_user.first).to eql(task_with_user)
end
it 'loads a combine relation with one parent with custom tuple key' do
expect(repo.task_with_owner.first).to eql(task_with_owner)
end
it 'loads a combined relation with many children' do
- expect(repo.users_with_tasks.to_a).to eql([jane_with_tasks, joe_with_tasks])
+ expect(repo.users_with_tasks.to_a).to match_array([jane_with_tasks, joe_with_tasks])
end
it 'loads a combined relation with one child' do
- expect(repo.users_with_task.to_a).to eql([jane_with_task, joe_with_task])
+ expect(repo.users_with_task.to_a).to match_array([jane_with_task, joe_with_task])
end
it 'loads a combined relation with one child restricted by given criteria' do
- expect(repo.users_with_task_by_title('Joe Task').to_a).to eql([
+ expect(repo.users_with_task_by_title('Joe Task').to_a).to match_array([
jane_without_task, joe_with_task
])
end
it 'loads nested combined relations' do