summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Luis Leal Cardoso Junior <andrehjr@gmail.com>2009-11-16 00:51:37 -0200
committerAndré Luis Leal Cardoso Junior <andrehjr@gmail.com>2009-11-16 00:51:37 -0200
commitf20d0ac3969a5679c57434b734e4725490ce249a (patch)
tree7ffb6800467e7270eac041cce4a3e9582a522213
parentbe69275fb3febe47382592288f49fecf5f204483 (diff)
downloadhashie-f20d0ac3969a5679c57434b734e4725490ce249a.tar.gz
Fixing inspect for Dashes
-rw-r--r--lib/hashie/hash_extensions.rb2
-rw-r--r--spec/hashie/dash_spec.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/hashie/hash_extensions.rb b/lib/hashie/hash_extensions.rb
index 67d73f6..956ec99 100644
--- a/lib/hashie/hash_extensions.rb
+++ b/lib/hashie/hash_extensions.rb
@@ -39,7 +39,7 @@ module Hashie
def hashie_inspect
ret = "<##{self.class.to_s}"
- keys.sort.each do |key|
+ stringify_keys.keys.sort.each do |key|
ret << " #{key}=#{self[key].inspect}"
end
ret << ">"
diff --git a/spec/hashie/dash_spec.rb b/spec/hashie/dash_spec.rb
index 97ed3c1..3a71c59 100644
--- a/spec/hashie/dash_spec.rb
+++ b/spec/hashie/dash_spec.rb
@@ -11,6 +11,12 @@ describe Hashie::Dash do
(Hashie::Dash < Hash).should be_true
end
+ it '#inspect should be ok!' do
+ dash = DashTest.new
+ dash.email = "abd@abc.com"
+ dash.inspect.should == "<#DashTest count=0 email=\"abd@abc.com\" first_name=nil>"
+ end
+
describe ' creating properties' do
it 'should add the property to the list' do
DashTest.property :not_an_att