Permalink
Browse files

Improve HashWithName#inspect, as it was confusing in tests (coming ou…

…t as "{}")
  • Loading branch information...
1 parent 1b02520 commit 6a141f25e379e975d809bc594a5344f70590c6d9 Mark Evans committed Dec 19, 2011
Showing with 12 additions and 0 deletions.
  1. +4 −0 lib/dragonfly/hash_with_name.rb
  2. +8 −0 spec/dragonfly/hash_with_name_spec.rb
View
4 lib/dragonfly/hash_with_name.rb
@@ -40,6 +40,10 @@ def name=(name)
name
end
+ def inspect
+ "HashWithName with name #{name.inspect}, hash #{super}"
+ end
+
end
end
View
8 spec/dragonfly/hash_with_name_spec.rb
@@ -81,4 +81,12 @@
end
end
+ describe "inspect" do
+ it "should show that it's a HashWithName" do
+ hash = Dragonfly::HashWithName.new
+ hash[:name] = 'doogs.barley'
+ hash.inspect.should =~ /HashWithName.*name.*doogs\.barley/
+ end
+ end
+
end

0 comments on commit 6a141f2

Please sign in to comment.