aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/integration/joins/with_compounds_spec.rb
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-05-16 17:38:15 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-05-16 17:38:15 -0700
commit732b222126bd6b37925a4fcdcda832de65858122 (patch)
tree2cc78e4983f36dd2fe368558ca23bb80ecce80fd /spec/arel/integration/joins/with_compounds_spec.rb
parentb06d351b701906efab737894be674c66561ec524 (diff)
downloadrails-732b222126bd6b37925a4fcdcda832de65858122.tar.gz
rails-732b222126bd6b37925a4fcdcda832de65858122.tar.bz2
rails-732b222126bd6b37925a4fcdcda832de65858122.zip
fixed string escaping issue
Diffstat (limited to 'spec/arel/integration/joins/with_compounds_spec.rb')
-rw-r--r--spec/arel/integration/joins/with_compounds_spec.rb24
1 files changed, 20 insertions, 4 deletions
diff --git a/spec/arel/integration/joins/with_compounds_spec.rb b/spec/arel/integration/joins/with_compounds_spec.rb
index 49f0132190..62d226acf2 100644
--- a/spec/arel/integration/joins/with_compounds_spec.rb
+++ b/spec/arel/integration/joins/with_compounds_spec.rb
@@ -8,9 +8,25 @@ module Arel
@predicate = @relation1[:id].eq(@relation2[:user_id])
end
- describe 'when a compound contains a join' do
- describe '#to_sql' do
- describe 'when the compound is a select' do
+ describe '#to_sql' do
+ describe 'when the join contains a select' do
+ describe 'and the select is given a string' do
+ it 'does not escape the string' do
+ @relation1 \
+ .join(@relation2.select("asdf")) \
+ .on(@predicate) \
+ .to_sql.should be_like("
+ SELECT `users`.`id`, `users`.`name`, `photos`.`id`, `photos`.`user_id`, `photos`.`camera_id`
+ FROM `users`
+ INNER JOIN `photos`
+ ON `users`.`id` = `photos`.`user_id` AND asdf
+ ")
+ end
+ end
+ end
+
+ describe 'when a compound contains a join' do
+ describe 'and the compound is a select' do
it 'manufactures sql disambiguating the tables' do
@relation1 \
.select(@relation1[:id].eq(1)) \
@@ -28,7 +44,7 @@ module Arel
end
end
- describe 'when the compound is a group' do
+ describe 'and the compound is a group' do
it 'manufactures sql disambiguating the tables' do
@relation1 \
.join(@relation2) \