Sha256: 73f17ec23b875b09901afa14ec4ecefb1e31a4ab448e6e3c428b3ebd00b6c64c

Contents?: true

Size: 721 Bytes

Versions: 24

Compression:

Stored size: 721 Bytes

Contents

require File.expand_path('spec/spec_helper')

describe Range do
  describe :last_element do
    it "is the last for normal ranges" do
      (1..2).last_element.should == 2
    end

    it "is the last for exclusive ranges" do
      (1...3).last_element.should == 2
    end
  end

  describe :move do
    it "does not modify the original" do
      a = 1..3
      a.move(3)
      a.should == (1..3)
    end

    it "can move 0" do
      (1..3).move(0).should == (1..3)
    end

    it "can move right" do
      (1..3).move(1).should == (2..4)
    end

    it "can move left" do
      (1..3).move(-2).should == (-1..1)
    end

    it "can move exclusive ranges" do
      (1...3).move(2).should == (3...5)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ruco-0.2.12 spec/ruco/core_ext/range_spec.rb
ruco-0.2.11 spec/ruco/core_ext/range_spec.rb
ruco-0.2.10 spec/ruco/core_ext/range_spec.rb
ruco-0.2.9 spec/ruco/core_ext/range_spec.rb
ruco-0.2.8 spec/ruco/core_ext/range_spec.rb
ruco-0.2.7 spec/ruco/core_ext/range_spec.rb
ruco-0.2.6 spec/ruco/core_ext/range_spec.rb
ruco-0.2.5 spec/ruco/core_ext/range_spec.rb
ruco-0.2.4 spec/ruco/core_ext/range_spec.rb
ruco-0.2.3 spec/ruco/core_ext/range_spec.rb
ruco-0.2.2 spec/ruco/core_ext/range_spec.rb
ruco-0.2.1 spec/ruco/core_ext/range_spec.rb
ruco-0.2.0 spec/ruco/core_ext/range_spec.rb
ruco-0.2.0.beta12 spec/ruco/core_ext/range_spec.rb
ruco-0.2.0.beta11 spec/ruco/core_ext/range_spec.rb
ruco-0.2.0.beta10 spec/ruco/core_ext/range_spec.rb
ruco-0.2.0.beta9 spec/ruco/core_ext/range_spec.rb
ruco-0.2.0.beta8 spec/ruco/core_ext/range_spec.rb
ruco-0.2.0.beta7 spec/ruco/core_ext/range_spec.rb
ruco-0.2.0.beta6 spec/ruco/core_ext/range_spec.rb