diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-04-11 15:22:22 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-04-11 15:22:22 -0700 |
commit | eee3a766160cd32a4d9b5e1352858597005c9cee (patch) | |
tree | 10b58d7c350198a0598e1387e221fb1fe8fc0078 /spec | |
parent | ad50e772d32c261e4463d67d5c50a25b21a36370 (diff) | |
download | rails-eee3a766160cd32a4d9b5e1352858597005c9cee.tar.gz rails-eee3a766160cd32a4d9b5e1352858597005c9cee.tar.bz2 rails-eee3a766160cd32a4d9b5e1352858597005c9cee.zip |
string passthrough for joins
Diffstat (limited to 'spec')
-rw-r--r-- | spec/active_relation/unit/relations/join_spec.rb | 14 | ||||
-rw-r--r-- | spec/active_relation/unit/relations/selection_spec.rb | 6 |
2 files changed, 13 insertions, 7 deletions
diff --git a/spec/active_relation/unit/relations/join_spec.rb b/spec/active_relation/unit/relations/join_spec.rb index 30ac73b611..b274da7565 100644 --- a/spec/active_relation/unit/relations/join_spec.rb +++ b/spec/active_relation/unit/relations/join_spec.rb @@ -108,7 +108,7 @@ module ActiveRelation end end - describe 'with aggregated relations' do + describe 'when joining aggregated relations' do before do @aggregation = @relation2 \ .aggregate(@relation2[:user_id], @relation2[:id].count) \ @@ -157,6 +157,16 @@ module ActiveRelation ") end end - end + end + + describe 'when joining with a string' do + it "passes the string through to the where clause" do + Join.new("INNER JOIN ON asdf", @relation1).to_sql.should be_like(" + SELECT `users`.`id`, `users`.`name` + FROM `users` + INNER JOIN ON asdf + ") + end + end end end
\ No newline at end of file diff --git a/spec/active_relation/unit/relations/selection_spec.rb b/spec/active_relation/unit/relations/selection_spec.rb index 1919d3007e..20833de58d 100644 --- a/spec/active_relation/unit/relations/selection_spec.rb +++ b/spec/active_relation/unit/relations/selection_spec.rb @@ -48,12 +48,8 @@ module ActiveRelation end describe 'when given a string' do - before do - @string = "asdf" - end - it "passes the string through to the where clause" do - Selection.new(@relation, @string).to_sql.should be_like(" + Selection.new(@relation, 'asdf').to_sql.should be_like(" SELECT `users`.`id`, `users`.`name` FROM `users` WHERE asdf |