spec/collection_spec.rb in rasti-db-0.2.6 vs spec/collection_spec.rb in rasti-db-0.2.7
- old
+ new
@@ -465,14 +465,14 @@
it 'Graph' do
stub_posts.graph(:user, :categories, 'comments.user.posts.categories').all
stub_db.sqls.must_equal [
'SELECT * FROM custom_schema.posts',
'SELECT * FROM custom_schema.users WHERE (id IN (1, 2))',
- 'SELECT * FROM custom_schema.categories INNER JOIN custom_schema.categories_posts ON (custom_schema.categories_posts.category_id = custom_schema.categories.id) WHERE (custom_schema.categories_posts.post_id IN (3, 4))',
+ 'SELECT custom_schema.categories.*, custom_schema.categories_posts.post_id AS source_foreign_key FROM custom_schema.categories INNER JOIN custom_schema.categories_posts ON (custom_schema.categories_posts.category_id = custom_schema.categories.id) WHERE (custom_schema.categories_posts.post_id IN (3, 4))',
'SELECT * FROM custom_schema.comments WHERE (post_id IN (3, 4))',
'SELECT * FROM custom_schema.users WHERE (id IN (2, 1))',
'SELECT * FROM custom_schema.posts WHERE (user_id IN (1, 2))',
- 'SELECT * FROM custom_schema.categories INNER JOIN custom_schema.categories_posts ON (custom_schema.categories_posts.category_id = custom_schema.categories.id) WHERE (custom_schema.categories_posts.post_id IN (3, 4))'
+ 'SELECT custom_schema.categories.*, custom_schema.categories_posts.post_id AS source_foreign_key FROM custom_schema.categories INNER JOIN custom_schema.categories_posts ON (custom_schema.categories_posts.category_id = custom_schema.categories.id) WHERE (custom_schema.categories_posts.post_id IN (3, 4))'
]
end
it 'Named query' do
stub_posts.commented_by(1).all
\ No newline at end of file