aboutsummaryrefslogtreecommitdiffstats
path: root/spec/active_relation/unit/relations
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-03-02 17:56:18 -0800
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-03-02 17:56:18 -0800
commitc54392872f024d55e8a23ead3065e6119a52b234 (patch)
tree905aee0f7c40436ff41979227e9eb72e4a6840ba /spec/active_relation/unit/relations
parent86550ef2bee377a5e4134dc63dedb138bb9ab7dc (diff)
downloadrails-c54392872f024d55e8a23ead3065e6119a52b234.tar.gz
rails-c54392872f024d55e8a23ead3065e6119a52b234.tar.bz2
rails-c54392872f024d55e8a23ead3065e6119a52b234.zip
introduced engine dependency for sql strategies
- hacked in default engine for scalars -- BAD
Diffstat (limited to 'spec/active_relation/unit/relations')
-rw-r--r--spec/active_relation/unit/relations/join_spec.rb6
-rw-r--r--spec/active_relation/unit/relations/table_spec.rb11
2 files changed, 17 insertions, 0 deletions
diff --git a/spec/active_relation/unit/relations/join_spec.rb b/spec/active_relation/unit/relations/join_spec.rb
index 532dc08753..64d41effc5 100644
--- a/spec/active_relation/unit/relations/join_spec.rb
+++ b/spec/active_relation/unit/relations/join_spec.rb
@@ -38,6 +38,12 @@ module ActiveRelation
end
end
+ describe '#engine' do
+ it "delegates to a relation's engine" do
+ Join.new("INNER JOIN", @relation1, @relation2, @predicate).engine.should == @relation1.engine
+ end
+ end
+
describe 'with simple relations' do
describe '#attributes' do
it 'combines the attributes of the two relations' do
diff --git a/spec/active_relation/unit/relations/table_spec.rb b/spec/active_relation/unit/relations/table_spec.rb
index 5c7fa35e63..8f14ce33cf 100644
--- a/spec/active_relation/unit/relations/table_spec.rb
+++ b/spec/active_relation/unit/relations/table_spec.rb
@@ -80,5 +80,16 @@ module ActiveRelation
hash[Table.new(:users)].should == 1
end
end
+
+ describe '#engine' do
+ it "defaults to global engine" do
+ Table.engine = engine = Engine.new
+ Table.new(:users).engine.should == engine
+ end
+
+ it "can be specified" do
+ Table.new(:users, engine = Engine.new).engine.should == engine
+ end
+ end
end
end \ No newline at end of file