From eee3a766160cd32a4d9b5e1352858597005c9cee Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Fri, 11 Apr 2008 15:22:22 -0700 Subject: string passthrough for joins --- spec/active_relation/unit/relations/join_spec.rb | 14 ++++++++++++-- spec/active_relation/unit/relations/selection_spec.rb | 6 +----- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'spec') 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 -- cgit v1.2.3