diff options
Diffstat (limited to 'spec/ruby/language/super_spec.rb')
| -rw-r--r-- | spec/ruby/language/super_spec.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/spec/ruby/language/super_spec.rb b/spec/ruby/language/super_spec.rb index 7d9e896d8b..f595d49395 100644 --- a/spec/ruby/language/super_spec.rb +++ b/spec/ruby/language/super_spec.rb @@ -83,8 +83,8 @@ describe "The super keyword" do end end - -> {sub_normal.new.foo}.should raise_error(NoMethodError, /super/) - -> {sub_zsuper.new.foo}.should raise_error(NoMethodError, /super/) + -> {sub_normal.new.foo}.should.raise(NoMethodError, /super/) + -> {sub_zsuper.new.foo}.should.raise(NoMethodError, /super/) end it "uses given block even if arguments are passed explicitly" do @@ -130,7 +130,7 @@ describe "The super keyword" do end end - c2.new.m('a') { raise }.should be_false + c2.new.m('a') { raise }.should == false end it "uses block argument given to method when used in a block" do @@ -200,7 +200,7 @@ describe "The super keyword" do end end - -> { klass.new.a(:a_called) }.should raise_error(RuntimeError) + -> { klass.new.a(:a_called) }.should.raise(RuntimeError) end it "is able to navigate to super, when a method is defined dynamically on the singleton class" do @@ -461,4 +461,18 @@ describe "The super keyword" do @all.foo('a', b: 'b').should == [['a'], {b: 'b'}] end end + + it "works in method definitions using **nil" do + parent = Class.new do + def m(*args, **kwargs) + [args, kwargs] + end + end + child = Class.new(parent) do + def m(*args, **nil) + super + end + end + child.new.m(1, 2).should == [[1, 2], {}] + end end |
