diff options
author | Xavier Noria <fxn@hashref.com> | 2012-05-07 13:01:58 -0700 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2012-05-07 13:01:58 -0700 |
commit | ed2feb7962bd97c2222ba609bb01fe5165a597c8 (patch) | |
tree | 445e0f8f9efbaa5183c14ba50c85c6518b0ef404 /activesupport | |
parent | 7746bf9a71804a2994f4e5c37faa3075efe1aec2 (diff) | |
parent | d785b292a8c921989f606696dff3765836d1fb44 (diff) | |
download | rails-ed2feb7962bd97c2222ba609bb01fe5165a597c8.tar.gz rails-ed2feb7962bd97c2222ba609bb01fe5165a597c8.tar.bz2 rails-ed2feb7962bd97c2222ba609bb01fe5165a597c8.zip |
Merge pull request #6064 from gazay/fix_guides_for_as_core_ext
Fix guides for as core ext
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/numeric/time.rb | 6 | ||||
-rw-r--r-- | activesupport/test/core_ext/range_ext_test.rb | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/numeric/time.rb b/activesupport/lib/active_support/core_ext/numeric/time.rb index 822f766af7..2bf3d1f278 100644 --- a/activesupport/lib/active_support/core_ext/numeric/time.rb +++ b/activesupport/lib/active_support/core_ext/numeric/time.rb @@ -8,13 +8,13 @@ class Numeric # These methods use Time#advance for precise date calculations when using from_now, ago, etc. # as well as adding or subtracting their results from a Time object. For example: # - # # equivalent to Time.now.advance(:months => 1) + # # equivalent to Time.current.advance(:months => 1) # 1.month.from_now # - # # equivalent to Time.now.advance(:years => 2) + # # equivalent to Time.current.advance(:years => 2) # 2.years.from_now # - # # equivalent to Time.now.advance(:months => 4, :years => 5) + # # equivalent to Time.current.advance(:months => 4, :years => 5) # (4.months + 5.years).from_now # # While these methods provide precise calculation when used as in the examples above, care diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb index cf1ec448c2..9c3389ba82 100644 --- a/activesupport/test/core_ext/range_ext_test.rb +++ b/activesupport/test/core_ext/range_ext_test.rb @@ -41,6 +41,18 @@ class RangeTest < ActiveSupport::TestCase assert((1..10).include?(1...10)) end + def test_should_compare_identical_inclusive + assert((1..10) === (1..10)) + end + + def test_should_compare_identical_exclusive + assert((1...10) === (1...10)) + end + + def test_should_compare_other_with_exlusive_end + assert((1..10) === (1...10)) + end + def test_exclusive_end_should_not_include_identical_with_inclusive_end assert !(1...10).include?(1..10) end |