aboutsummaryrefslogtreecommitdiffstats
path: root/spec/active_relation/primitives/attribute_spec.rb
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-02-03 22:10:38 -0800
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-02-03 22:10:38 -0800
commitb6c0de24fadc6b9e124a36aa35718edc027130de (patch)
tree8d965b22c97102ed269e47ad5882be8e71a068d9 /spec/active_relation/primitives/attribute_spec.rb
parent6c73e3dbc714a9752a66a6da51e7e41f372797b3 (diff)
downloadrails-b6c0de24fadc6b9e124a36aa35718edc027130de.tar.gz
rails-b6c0de24fadc6b9e124a36aa35718edc027130de.tar.bz2
rails-b6c0de24fadc6b9e124a36aa35718edc027130de.zip
this is very messy but it is finally close to feature-complete
Diffstat (limited to 'spec/active_relation/primitives/attribute_spec.rb')
-rw-r--r--spec/active_relation/primitives/attribute_spec.rb25
1 files changed, 8 insertions, 17 deletions
diff --git a/spec/active_relation/primitives/attribute_spec.rb b/spec/active_relation/primitives/attribute_spec.rb
index f76018c493..0c6c44f1f4 100644
--- a/spec/active_relation/primitives/attribute_spec.rb
+++ b/spec/active_relation/primitives/attribute_spec.rb
@@ -14,19 +14,19 @@ module ActiveRelation
describe '#as' do
it "manufactures an aliased attributed" do
- @attribute.as(:alias).should == Attribute.new(@relation1, @attribute.name, :alias)
+ @attribute.as(:alias).should == Attribute.new(@relation1, @attribute.name, :alias, @attribute)
end
end
describe '#substitute' do
it "manufactures an attribute with the relation substituted" do
- @attribute.substitute(@relation2).should == Attribute.new(@relation2, @attribute.name)
+ @attribute.substitute(@relation2).should == Attribute.new(@relation2, @attribute.name, nil, @attribute)
end
end
describe '#qualify' do
it "manufactures an attribute aliased with that attributes qualified name" do
- @attribute.qualify.should == Attribute.new(@attribute.relation, @attribute.name, @attribute.qualified_name)
+ @attribute.qualify.should == Attribute.new(@attribute.relation, @attribute.name, @attribute.qualified_name, @attribute)
end
end
@@ -53,6 +53,10 @@ module ActiveRelation
end
describe '#to_sql' do
+ it "needs to test prefix_for" do
+ pending
+ end
+
describe Sql::Strategy do
it "manufactures sql without an alias if the strategy is Predicate" do
Attribute.new(@relation1, :name, :alias).to_sql(Sql::Predicate.new).should be_like("`foo`.`name`")
@@ -62,19 +66,6 @@ module ActiveRelation
Attribute.new(@relation1, :name, :alias).to_sql(Sql::Projection.new).should be_like("`foo`.`name` AS 'alias'")
end
end
-
- describe 'binding' do
- before do
- @attribute = Attribute.new(@relation1, :name, :alias)
- @aliased_relation = @relation1.as(:schmoo)
- end
-
- it "is fancy pants" do
- pending
- @attribute.to_sql.should be_like("`foo`.`name`")
- @attribute.substitute(@aliased_relation).to_sql.should be_like("`schmoo`.`alias`")
- end
- end
end
describe Attribute::Predications do
@@ -120,7 +111,7 @@ module ActiveRelation
end
end
- describe 'Expressions' do
+ describe Attribute::Expressions do
before do
@attribute1 = Attribute.new(@relation1, :name)
end