diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-05-27 14:37:11 -0700 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2009-05-17 15:46:19 -0400 |
commit | 20b28b441b651d0404d64049253898c061a039be (patch) | |
tree | 4b9a8fc9e8f9207017248f129550c0283b0f520b /spec/arel/algebra/unit/primitives/attribute_spec.rb | |
parent | 2fe585328d6a24df310d3e60059c9c7b05b64bac (diff) | |
download | rails-20b28b441b651d0404d64049253898c061a039be.tar.gz rails-20b28b441b651d0404d64049253898c061a039be.tar.bz2 rails-20b28b441b651d0404d64049253898c061a039be.zip |
using in memory relations as results from sql relation
Conflicts:
lib/arel/algebra/primitives/expression.rb
lib/arel/algebra/relations/relation.rb
Diffstat (limited to 'spec/arel/algebra/unit/primitives/attribute_spec.rb')
-rw-r--r-- | spec/arel/algebra/unit/primitives/attribute_spec.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/arel/algebra/unit/primitives/attribute_spec.rb b/spec/arel/algebra/unit/primitives/attribute_spec.rb index bab9fad3d5..dcac5abf65 100644 --- a/spec/arel/algebra/unit/primitives/attribute_spec.rb +++ b/spec/arel/algebra/unit/primitives/attribute_spec.rb @@ -26,8 +26,16 @@ module Arel end describe '#to_attribute' do - it "returns self" do - @attribute.to_attribute.should == @attribute + describe 'when the given relation is the same as the attributes relation' do + it "returns self" do + @attribute.to_attribute(@relation).should == @attribute + end + end + + describe 'when the given relation differs from the attributes relation' do + it 'binds to the new relation' do + @attribute.to_attribute(new_relation = @relation.alias).should == @attribute.bind(new_relation) + end end end end |