diff options
Diffstat (limited to 'spec/ruby/core/enumerator/chain/size_spec.rb')
-rw-r--r-- | spec/ruby/core/enumerator/chain/size_spec.rb | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/spec/ruby/core/enumerator/chain/size_spec.rb b/spec/ruby/core/enumerator/chain/size_spec.rb index 42c31ac10b..d85b88ee8b 100644 --- a/spec/ruby/core/enumerator/chain/size_spec.rb +++ b/spec/ruby/core/enumerator/chain/size_spec.rb @@ -1,24 +1,22 @@ require_relative '../../../spec_helper' require_relative '../../enumerable/fixtures/classes' -ruby_version_is "2.6" do - describe "Enumerator::Chain#size" do - it "returns the sum of the sizes of the elements" do +describe "Enumerator::Chain#size" do + it "returns the sum of the sizes of the elements" do + a = mock('size') + a.should_receive(:size).and_return(40) + Enumerator::Chain.new(a, [:a, :b]).size.should == 42 + end + + it "returns nil or Infinity for the first element of such a size" do + [nil, Float::INFINITY].each do |special| a = mock('size') a.should_receive(:size).and_return(40) - Enumerator::Chain.new(a, [:a, :b]).size.should == 42 - end - - it "returns nil or Infinity for the first element of such a size" do - [nil, Float::INFINITY].each do |special| - a = mock('size') - a.should_receive(:size).and_return(40) - b = mock('special') - b.should_receive(:size).and_return(special) - c = mock('not called') - c.should_not_receive(:size) - Enumerator::Chain.new(a, b, c).size.should == special - end + b = mock('special') + b.should_receive(:size).and_return(special) + c = mock('not called') + c.should_not_receive(:size) + Enumerator::Chain.new(a, b, c).size.should == special end end end |