Skip to content

Commit bb0de54

Browse files
committed
Add spec for super with implicit block argument.
1 parent 13f1f9f commit bb0de54

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/ruby/language/super_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@ def m(v)
102102
c2.new.m(:dump) { :value }.should == :value
103103
end
104104

105+
it "uses block argument given to method when used in a block" do
106+
c1 = Class.new do
107+
def m
108+
yield
109+
end
110+
end
111+
c2 = Class.new(c1) do
112+
def m(v)
113+
ary = []
114+
1.times do
115+
ary << super()
116+
end
117+
ary
118+
end
119+
end
120+
121+
c2.new.m(:dump) { :value }.should == [ :value ]
122+
end
123+
105124
it "calls the superclass method when in a block" do
106125
SuperSpecs::S6.new.here.should == :good
107126
end

0 commit comments

Comments
 (0)