diff options
author | Bryan Helmkamp <bryan@brynary.com> | 2009-05-18 01:49:50 -0400 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2009-05-18 01:49:50 -0400 |
commit | 082079169caab2a00f62d9de9c4bdb5dcbc591aa (patch) | |
tree | 8bb2524b539fd11a46059e5336a8a0c3c1c2815b | |
parent | 8feb358bd00cea30eb677e32f10995f5eddc167a (diff) | |
download | rails-082079169caab2a00f62d9de9c4bdb5dcbc591aa.tar.gz rails-082079169caab2a00f62d9de9c4bdb5dcbc591aa.tar.bz2 rails-082079169caab2a00f62d9de9c4bdb5dcbc591aa.zip |
Better inspect output for Expressions
-rw-r--r-- | lib/arel/algebra/primitives/expression.rb | 4 | ||||
-rw-r--r-- | spec/arel/algebra/unit/primitives/expression_spec.rb | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/arel/algebra/primitives/expression.rb b/lib/arel/algebra/primitives/expression.rb index 5566e2d0b7..875498c282 100644 --- a/lib/arel/algebra/primitives/expression.rb +++ b/lib/arel/algebra/primitives/expression.rb @@ -13,6 +13,10 @@ module Arel true end + def inspect + "<#{self.class.name} #{attribute.inspect}>" + end + module Transformations def as(aliaz) self.class.new(attribute, aliaz, self) diff --git a/spec/arel/algebra/unit/primitives/expression_spec.rb b/spec/arel/algebra/unit/primitives/expression_spec.rb index 82d12d53f9..768bb492a7 100644 --- a/spec/arel/algebra/unit/primitives/expression_spec.rb +++ b/spec/arel/algebra/unit/primitives/expression_spec.rb @@ -7,6 +7,12 @@ module Arel @attribute = @relation[:id] end + describe "#inspect" do + it "returns a simple, short inspect string" do + @attribute.count.inspect.should == "<Arel::Count <Attribute id>>" + end + end + describe Expression::Transformations do before do @expression = Count.new(@attribute) |