summaryrefslogtreecommitdiff
path: root/spec/ruby/core/enumerable/shared/collect.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/enumerable/shared/collect.rb')
-rw-r--r--spec/ruby/core/enumerable/shared/collect.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/enumerable/shared/collect.rb b/spec/ruby/core/enumerable/shared/collect.rb
index 32c1722c75..6df1a616eb 100644
--- a/spec/ruby/core/enumerable/shared/collect.rb
+++ b/spec/ruby/core/enumerable/shared/collect.rb
@@ -89,5 +89,19 @@ describe :enumerable_collect, shared: true do
end.should raise_error(ArgumentError)
end
+ it "calls the each method on sub-classes" do
+ c = Class.new(Hash) do
+ def each
+ ScratchPad << 'in each'
+ super
+ end
+ end
+ h = c.new
+ h[1] = 'a'
+ ScratchPad.record []
+ h.send(@method) { |k,v| v }
+ ScratchPad.recorded.should == ['in each']
+ end
+
it_should_behave_like :enumerable_enumeratorized_with_origin_size
end