diff options
Diffstat (limited to 'spec/relations/attribute_spec.rb')
-rw-r--r-- | spec/relations/attribute_spec.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/spec/relations/attribute_spec.rb b/spec/relations/attribute_spec.rb index 5f2d70ec48..78d602abf9 100644 --- a/spec/relations/attribute_spec.rb +++ b/spec/relations/attribute_spec.rb @@ -6,7 +6,7 @@ describe Attribute do @relation2 = TableRelation.new(:bar) end - describe Attribute, '#eql?' do + describe '#eql?' do it "obtains if the relation and attribute name are identical" do Attribute.new(@relation1, :attribute_name).should be_eql(Attribute.new(@relation1, :attribute_name)) Attribute.new(@relation1, :attribute_name).should_not be_eql(Attribute.new(@relation1, :another_attribute_name)) @@ -14,47 +14,52 @@ describe Attribute do end end - describe Attribute, 'predications' do + describe 'predications' do before do @attribute1 = Attribute.new(@relation1, :attribute_name) @attribute2 = Attribute.new(@relation2, :attribute_name) end - describe Attribute, '==' do + describe '==' do it "manufactures an equality predicate" do (@attribute1 == @attribute2).should == EqualityPredicate.new(@attribute1, @attribute2) end end - describe Attribute, '<' do + describe '<' do it "manufactures a less-than predicate" do (@attribute1 < @attribute2).should == LessThanPredicate.new(@attribute1, @attribute2) end end - describe Attribute, '<=' do + describe '<=' do it "manufactures a less-than or equal-to predicate" do (@attribute1 <= @attribute2).should == LessThanOrEqualToPredicate.new(@attribute1, @attribute2) end end - describe Attribute, '>' do + describe '>' do it "manufactures a greater-than predicate" do (@attribute1 > @attribute2).should == GreaterThanPredicate.new(@attribute1, @attribute2) end end - describe Attribute, '>=' do + describe '>=' do it "manufactures a greater-than or equal to predicate" do (@attribute1 >= @attribute2).should == GreaterThanOrEqualToPredicate.new(@attribute1, @attribute2) end end - describe Attribute, '=~' do + describe '=~' do it "manufactures a match predicate" do (@attribute1 =~ /.*/).should == MatchPredicate.new(@attribute1, @attribute2) end end - + end + + describe '#to_sql' do + it "manufactures a column" do + Attribute.new(@relation1, :attribute_name).to_sql.should == ColumnBuilder.new(@relation1.table, :attribute_name) + end end end |