Changeset 7486
- Timestamp:
- 09/15/07 21:39:04 (2 years ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/core_ext/array.rb (modified) (1 diff)
- trunk/activesupport/Rakefile (modified) (1 diff)
- trunk/activesupport/test/abstract_unit.rb (modified) (1 diff)
- trunk/activesupport/test/core_ext/array_ext_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r7473 r7486 1 1 *SVN* 2 3 * Added Array#rand #9170 [norbert]. Examples: 4 5 [].rand # => nil 6 ['a'].rand # => 'a' 7 [1,2,3].rand # => 1 or 2 or 3 2 8 3 9 * Deprecation: removed Reloadable. [Jeremy Kemper] trunk/activesupport/lib/active_support/core_ext/array.rb
r7217 r7486 1 1 require File.dirname(__FILE__) + '/array/conversions' 2 require File.dirname(__FILE__) + '/array/extract_options' 2 3 require File.dirname(__FILE__) + '/array/grouping' 3 require File.dirname(__FILE__) + '/array/ extract_options'4 require File.dirname(__FILE__) + '/array/random_access' 4 5 5 6 class Array #:nodoc: 6 7 include ActiveSupport::CoreExtensions::Array::Conversions 8 include ActiveSupport::CoreExtensions::Array::ExtractOptions 7 9 include ActiveSupport::CoreExtensions::Array::Grouping 8 include ActiveSupport::CoreExtensions::Array:: ExtractOptions10 include ActiveSupport::CoreExtensions::Array::RandomAccess 9 11 end trunk/activesupport/Rakefile
r6881 r7486 19 19 t.pattern = 'test/**/*_test.rb' 20 20 t.verbose = true 21 t.warning = true22 21 } 23 22 trunk/activesupport/test/abstract_unit.rb
r4966 r7486 4 4 require 'active_support' 5 5 6 # Wrap tests that use Mocha and skip if unavailable. 7 def uses_mocha(test_name) 8 require 'rubygems' 9 require 'mocha' 10 yield 11 rescue LoadError 12 $stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again." 13 end 14 6 15 # Show backtraces for deprecated behavior for quicker cleanup. 7 16 ActiveSupport::Deprecation.debug = true trunk/activesupport/test/core_ext/array_ext_test.rb
r7474 r7486 201 201 end 202 202 end 203 204 uses_mocha "ArrayExtRandomTests" do 205 206 class ArrayExtRandomTests < Test::Unit::TestCase 207 def test_random_element_from_array 208 assert_nil [].rand 209 210 Kernel.expects(:rand).with(1).returns(0) 211 assert_equal 'x', ['x'].rand 212 213 Kernel.expects(:rand).with(3).returns(1) 214 assert_equal 2, [1, 2, 3].rand 215 end 216 end 217 218 end