summaryrefslogtreecommitdiff
path: root/spec/ruby/core/enumerator/arithmetic_sequence/end_spec.rb
blob: 05429cac3e824daa7aa026a57bcc84bfeec27019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require_relative '../../../spec_helper'

describe "Enumerator::ArithmeticSequence#end" do
  it "returns the end of the sequence" do
    1.step(10).end.should == 10
    (1..10).step.end.should == 10
    (1...10).step(17).end.should == 10
  end

  context "with endless" do
    it "returns nil as end of the sequence" do
      (1..).step(1).end.should == nil
      (1...).step(1).end.should == nil
    end
  end
end