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

describe "Enumerator::ArithmeticSequence#==" do
  it "returns true if begin, end, step and exclude_end? are equal" do
    1.step(10).should == 1.step(10)
    1.step(10, 5).should == 1.step(10, 5)

    (1..10).step.should == (1..10).step
    (1...10).step(8).should == (1...10).step(8)

    # both have exclude_end? == false
    (1..10).step(100).should == 1.step(10, 100)

    ((1..10).step == (1..11).step).should == false
    ((1..10).step == (1...10).step).should == false
    ((1..10).step == (1..10).step(2)).should == false
  end
end