summaryrefslogtreecommitdiff
path: root/spec/ruby/core/data/shared
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/data/shared')
-rw-r--r--spec/ruby/core/data/shared/inspect.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/core/data/shared/inspect.rb b/spec/ruby/core/data/shared/inspect.rb
index 7f54a46de3..6cd5664da7 100644
--- a/spec/ruby/core/data/shared/inspect.rb
+++ b/spec/ruby/core/data/shared/inspect.rb
@@ -50,5 +50,13 @@ describe :data_inspect, shared: true do
a.send(@method).should == "#<data DataSpecs::Measure amount=42, unit=#<data DataSpecs::Measure:...>>"
end
+
+ it "returns string representation with recursive attribute replaced with ... when an anonymous class" do
+ klass = Class.new(DataSpecs::Measure)
+ a = klass.allocate
+ a.send(:initialize, amount: 42, unit: a)
+
+ a.send(@method).should =~ /#<data amount=42, unit=#<data #<Class:0x.+?>:\.\.\.>>/
+ end
end
end