diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-09-29 16:03:58 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-09-29 16:03:58 +0200 |
commit | 1c938a72aa9378f982dbc55327e86150c47b8707 (patch) | |
tree | 34a0bb0a45396c26eed111877a810c3aa793bff5 /spec/ruby/core/numeric/step_spec.rb | |
parent | 31bb66a19df26409c9d47afcf37919c9a065516a (diff) | |
download | ruby-1c938a72aa9378f982dbc55327e86150c47b8707.tar.gz |
Update to ruby/spec@519df35
Diffstat (limited to 'spec/ruby/core/numeric/step_spec.rb')
-rw-r--r-- | spec/ruby/core/numeric/step_spec.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/spec/ruby/core/numeric/step_spec.rb b/spec/ruby/core/numeric/step_spec.rb index fc80cc4ab0..e9067864c8 100644 --- a/spec/ruby/core/numeric/step_spec.rb +++ b/spec/ruby/core/numeric/step_spec.rb @@ -16,9 +16,8 @@ describe "Numeric#step" do before :all do # This lambda definition limits to return the arguments it receives. # It's needed to test numeric_step behaviour with positional arguments. - @step_args = -> *args { args } + @step = -> receiver, *args, &block { receiver.step(*args, &block) } end - it_behaves_like :numeric_step, :step describe "when no block is given" do @@ -135,13 +134,12 @@ describe "Numeric#step" do end before :all do - # This lambda transforms a positional step method args into - # keyword arguments. + # This lambda transforms a positional step method args into keyword arguments. # It's needed to test numeric_step behaviour with keyword arguments. - @step_args = -> *args do - kw_args = {to: args[0]} + @step = -> receiver, *args, &block do + kw_args = { to: args[0] } kw_args[:by] = args[1] if args.size == 2 - [kw_args] + receiver.step(**kw_args, &block) end end it_behaves_like :numeric_step, :step @@ -183,16 +181,17 @@ describe "Numeric#step" do end end end + before :all do # This lambda definition transforms a positional step method args into # a mix of positional and keyword arguments. # It's needed to test numeric_step behaviour with positional mixed with # keyword arguments. - @step_args = -> *args do + @step = -> receiver, *args, &block do if args.size == 2 - [args[0], {by: args[1]}] + receiver.step(args[0], by: args[1], &block) else - args + receiver.step(*args, &block) end end end |