Sha256: 7c04b01521c159647400151fca951a4fead9cbae2584542978600cfd78464ffb

Contents?: true

Size: 875 Bytes

Versions: 14

Compression:

Stored size: 875 Bytes

Contents

describe 'array access' do
  describe "from" do
    it "should return the tail of an array from position" do
      ['a', 'b', 'c', 'd'].from(0).should == ["a", "b", "c", "d"]
      ['a', 'b', 'c', 'd'].from(2).should == ["c", "d"]
      ['a', 'b', 'c', 'd'].from(10).should == []
      [].from(0).should == []
    end
  end
  
  describe "to" do
    it "should return the head of an array up to position" do
      ['a', 'b', 'c', 'd'].to(0).should == ["a"]
      ['a', 'b', 'c', 'd'].to(2).should == ["a", "b", "c"]
      ['a', 'b', 'c', 'd'].to(10).should == ["a", "b", "c", "d"]
      [].to(0).should == []
    end
  end
  
  describe "second" do
    it "should return the second element in an array" do
      ['a', 'b', 'c', 'd'].second.should == 'b'
    end
    
    it "should return nil if there is no second element" do
      [].second.should == nil
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
motion-support-1.2.1 spec/motion-support/core_ext/array/access_spec.rb
motion-support-1.1.1 spec/motion-support/core_ext/array/access_spec.rb
motion-support-1.2.0 spec/motion-support/core_ext/array/access_spec.rb
motion-support-1.1.0 spec/motion-support/core_ext/array/access_spec.rb
motion-support-1.0.0 spec/motion-support/core_ext/array/access_spec.rb
motion-support-0.3.0 spec/motion-support/core_ext/array/access_spec.rb
motion_blender-support-0.2.8 spec/motion-support/core_ext/array/access_spec.rb
motion_blender-support-0.2.7 spec/motion-support/core_ext/array/access_spec.rb
motion-support-0.2.6 spec/motion-support/core_ext/array/access_spec.rb
motion-support-0.2.5 spec/motion-support/core_ext/array/access_spec.rb
motion-support-0.2.4 spec/motion-support/core_ext/array/access_spec.rb
motion-support-0.2.3 spec/motion-support/core_ext/array/access_spec.rb
motion-support-0.2.2 spec/motion-support/core_ext/array/access_spec.rb
motion-support-0.2.0 spec/motion-support/core_ext/array/access_spec.rb