mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #13055 from dmitriy-kiriyenko/fix-segmentation-fault-it-ruby-2.0.0-p353
Fix segmentation fault in Ruby 2.0.0-p353.
This commit is contained in:
commit
cd4d931659
2 changed files with 13 additions and 0 deletions
|
@ -99,6 +99,14 @@ module ActiveSupport
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
# We define it as a workaround to Ruby 2.0.0-p353 bug.
|
||||||
|
# For more information, check rails/rails#13055.
|
||||||
|
# It should be dropped once a new Ruby patch-level
|
||||||
|
# release after 2.0.0-p353 happens.
|
||||||
|
def ===(other) #:nodoc:
|
||||||
|
value === other
|
||||||
|
end
|
||||||
|
|
||||||
def method_missing(method, *args, &block) #:nodoc:
|
def method_missing(method, *args, &block) #:nodoc:
|
||||||
value.send(method, *args, &block)
|
value.send(method, *args, &block)
|
||||||
end
|
end
|
||||||
|
|
|
@ -158,6 +158,11 @@ class DurationTest < ActiveSupport::TestCase
|
||||||
assert_equal '172800', 2.days.to_json
|
assert_equal '172800', 2.days.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_case_when
|
||||||
|
cased = case 1.day when 1.day then "ok" end
|
||||||
|
assert_equal cased, "ok"
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def with_env_tz(new_tz = 'US/Eastern')
|
def with_env_tz(new_tz = 'US/Eastern')
|
||||||
old_tz, ENV['TZ'] = ENV['TZ'], new_tz
|
old_tz, ENV['TZ'] = ENV['TZ'], new_tz
|
||||||
|
|
Loading…
Reference in a new issue