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

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

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