spec/integration/repository/aggregate_spec.rb in rom-repository-1.3.2 vs spec/integration/repository/aggregate_spec.rb in rom-repository-1.3.3
- old
+ new
@@ -7,9 +7,18 @@
include_context 'database'
include_context 'relations'
include_context 'seeds'
+ it 'loads a graph with aliased children and its parents' do
+ user = repo.aggregate(aliased_posts: :author).first
+
+ expect(user.aliased_posts.count).to be(1)
+ expect(user.aliased_posts[0].author.id).to be(user.id)
+ expect(user.aliased_posts[0].author.name).to eql(user.name)
+ end
+
+
it 'exposes nodes via `node` method' do
jane = repo.
aggregate(:posts).
node(:posts) { |posts| posts.where(title: 'Another one') }.
where(name: 'Jane').one