spec/arel/engines/sql/unit/relations/join_spec.rb in arel-0.2.1 vs spec/arel/engines/sql/unit/relations/join_spec.rb in arel-0.3.0
- old
+ new
@@ -26,12 +26,20 @@
FROM `users`
INNER JOIN `photos` ON `users`.`id` = `photos`.`user_id`
})
end
- adapter_is_not :mysql do
+ adapter_is :oracle do
sql.should be_like(%Q{
+ SELECT "USERS"."ID", "USERS"."NAME", "PHOTOS"."ID", "PHOTOS"."USER_ID", "PHOTOS"."CAMERA_ID"
+ FROM "USERS"
+ INNER JOIN "PHOTOS" ON "USERS"."ID" = "PHOTOS"."USER_ID"
+ })
+ end
+
+ adapter_is_not :mysql, :oracle do
+ sql.should be_like(%Q{
SELECT "users"."id", "users"."name", "photos"."id", "photos"."user_id", "photos"."camera_id"
FROM "users"
INNER JOIN "photos" ON "users"."id" = "photos"."user_id"
})
end
@@ -42,19 +50,27 @@
sql = InnerJoin.new(@relation3, @relation2, @predicate2).to_sql
adapter_is :mysql do
sql.should be_like(%Q{
SELECT `super_users`.`id`, `super_users`.`name`, `photos`.`id`, `photos`.`user_id`, `photos`.`camera_id`
- FROM `users` AS `super_users`
+ FROM `users` `super_users`
INNER JOIN `photos` ON `super_users`.`id` = `photos`.`user_id`
})
end
- adapter_is_not :mysql do
+ adapter_is :oracle do
sql.should be_like(%Q{
+ SELECT "SUPER_USERS"."ID", "SUPER_USERS"."NAME", "PHOTOS"."ID", "PHOTOS"."USER_ID", "PHOTOS"."CAMERA_ID"
+ FROM "USERS" "SUPER_USERS"
+ INNER JOIN "PHOTOS" ON "SUPER_USERS"."ID" = "PHOTOS"."USER_ID"
+ })
+ end
+
+ adapter_is_not :mysql, :oracle do
+ sql.should be_like(%Q{
SELECT "super_users"."id", "super_users"."name", "photos"."id", "photos"."user_id", "photos"."camera_id"
- FROM "users" AS "super_users"
+ FROM "users" "super_users"
INNER JOIN "photos" ON "super_users"."id" = "photos"."user_id"
})
end
end
end
@@ -64,20 +80,28 @@
sql = InnerJoin.new(@relation3, @relation4, @predicate3).to_sql
adapter_is :mysql do
sql.should be_like(%Q{
SELECT `super_users`.`id`, `super_users`.`name`, `super_photos`.`id`, `super_photos`.`user_id`, `super_photos`.`camera_id`
- FROM `users` AS `super_users`
- INNER JOIN `photos` AS `super_photos` ON `super_users`.`id` = `super_photos`.`user_id`
+ FROM `users` `super_users`
+ INNER JOIN `photos` `super_photos` ON `super_users`.`id` = `super_photos`.`user_id`
})
end
- adapter_is_not :mysql do
+ adapter_is :oracle do
sql.should be_like(%Q{
+ SELECT "SUPER_USERS"."ID", "SUPER_USERS"."NAME", "SUPER_PHOTOS"."ID", "SUPER_PHOTOS"."USER_ID", "SUPER_PHOTOS"."CAMERA_ID"
+ FROM "USERS" "SUPER_USERS"
+ INNER JOIN "PHOTOS" "SUPER_PHOTOS" ON "SUPER_USERS"."ID" = "SUPER_PHOTOS"."USER_ID"
+ })
+ end
+
+ adapter_is_not :mysql, :oracle do
+ sql.should be_like(%Q{
SELECT "super_users"."id", "super_users"."name", "super_photos"."id", "super_photos"."user_id", "super_photos"."camera_id"
- FROM "users" AS "super_users"
- INNER JOIN "photos" AS "super_photos" ON "super_users"."id" = "super_photos"."user_id"
+ FROM "users" "super_users"
+ INNER JOIN "photos" "super_photos" ON "super_users"."id" = "super_photos"."user_id"
})
end
end
end
@@ -93,12 +117,20 @@
FROM `users`
INNER JOIN asdf ON fdsa
})
end
- adapter_is_not :mysql do
+ adapter_is :oracle do
sql.should be_like(%Q{
+ SELECT "USERS"."ID", "USERS"."NAME"
+ FROM "USERS"
+ INNER JOIN asdf ON fdsa
+ })
+ end
+
+ adapter_is_not :mysql, :oracle do
+ sql.should be_like(%Q{
SELECT "users"."id", "users"."name"
FROM "users"
INNER JOIN asdf ON fdsa
})
end
@@ -117,10 +149,20 @@
INNER JOIN lifo ON fifo
INNER JOIN hatful ON hallow
})
end
- adapter_is_not :mysql do
+ adapter_is :oracle do
+ sql.should be_like(%Q{
+ SELECT "USERS"."ID", "USERS"."NAME"
+ FROM "USERS"
+ INNER JOIN asdf ON fdsa
+ INNER JOIN lifo ON fifo
+ INNER JOIN hatful ON hallow
+ })
+ end
+
+ adapter_is_not :mysql, :oracle do
sql.should be_like(%Q{
SELECT "users"."id", "users"."name"
FROM "users"
INNER JOIN asdf ON fdsa
INNER JOIN lifo ON fifo