Sha256: 17f7b43885918360cd10bd07f9e089cfa963b53644bf02d7398e4c43527531f3
Contents?: true
Size: 914 Bytes
Versions: 2
Compression:
Stored size: 914 Bytes
Contents
require 'abstract_unit' require 'active_support/core_ext/array' class AccessTest < ActiveSupport::TestCase def test_from assert_equal %w( a b c d ), %w( a b c d ).from(0) assert_equal %w( c d ), %w( a b c d ).from(2) assert_equal %w(), %w( a b c d ).from(10) assert_equal %w( d e ), %w( a b c d e ).from(-2) assert_equal %w(), %w( a b c d e ).from(-10) end def test_to assert_equal %w( a ), %w( a b c d ).to(0) assert_equal %w( a b c ), %w( a b c d ).to(2) assert_equal %w( a b c d ), %w( a b c d ).to(10) assert_equal %w( a b c ), %w( a b c d ).to(-2) assert_equal %w(), %w( a b c ).to(-10) end def test_specific_accessor array = (1..42).to_a assert_equal array[1], array.second assert_equal array[2], array.third assert_equal array[3], array.fourth assert_equal array[4], array.fifth assert_equal array[41], array.forty_two end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activejob-lock-0.0.2 | rails/activesupport/test/core_ext/array/access_test.rb |
activejob-lock-0.0.1 | rails/activesupport/test/core_ext/array/access_test.rb |