diff options
Diffstat (limited to 'spec/ruby/core/enumerator/yielder')
-rw-r--r-- | spec/ruby/core/enumerator/yielder/append_spec.rb | 24 | ||||
-rw-r--r-- | spec/ruby/core/enumerator/yielder/to_proc_spec.rb | 20 |
2 files changed, 15 insertions, 29 deletions
diff --git a/spec/ruby/core/enumerator/yielder/append_spec.rb b/spec/ruby/core/enumerator/yielder/append_spec.rb index 7f7059774d..a36e5d64b6 100644 --- a/spec/ruby/core/enumerator/yielder/append_spec.rb +++ b/spec/ruby/core/enumerator/yielder/append_spec.rb @@ -23,25 +23,13 @@ describe "Enumerator::Yielder#<<" do end context "when multiple arguments passed" do - ruby_version_is '' ... '2.6' do - it "yields the arguments list to the block" do - ary = [] - y = Enumerator::Yielder.new { |*x| ary << x } - y.<<(1, 2) - - ary.should == [[1, 2]] - end - end + it "raises an ArgumentError" do + ary = [] + y = Enumerator::Yielder.new { |*x| ary << x } - ruby_version_is '2.6' do - it "raises an ArgumentError" do - ary = [] - y = Enumerator::Yielder.new { |*x| ary << x } - - -> { - y.<<(1, 2) - }.should raise_error(ArgumentError, /wrong number of arguments/) - end + -> { + y.<<(1, 2) + }.should raise_error(ArgumentError, /wrong number of arguments/) end end end diff --git a/spec/ruby/core/enumerator/yielder/to_proc_spec.rb b/spec/ruby/core/enumerator/yielder/to_proc_spec.rb index 0ed1645853..1d3681ab50 100644 --- a/spec/ruby/core/enumerator/yielder/to_proc_spec.rb +++ b/spec/ruby/core/enumerator/yielder/to_proc_spec.rb @@ -1,18 +1,16 @@ require_relative '../../../spec_helper' -ruby_version_is "2.7" do - describe "Enumerator::Yielder#to_proc" do - it "returns a Proc object that takes an argument and yields it to the block" do - ScratchPad.record [] - y = Enumerator::Yielder.new { |*args| ScratchPad << args; "foobar" } +describe "Enumerator::Yielder#to_proc" do + it "returns a Proc object that takes an argument and yields it to the block" do + ScratchPad.record [] + y = Enumerator::Yielder.new { |*args| ScratchPad << args; "foobar" } - callable = y.to_proc - callable.class.should == Proc + callable = y.to_proc + callable.class.should == Proc - result = callable.call(1, 2) - ScratchPad.recorded.should == [[1, 2]] + result = callable.call(1, 2) + ScratchPad.recorded.should == [[1, 2]] - result.should == "foobar" - end + result.should == "foobar" end end |