Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8523

Show
Ignore:
Timestamp:
01/02/08 09:08:14 (8 months ago)
Author:
bitsweat
Message:

Ruby 1.9 compat: add #raise to AS::BasicObject, fixup Duration argument error. Closes #10594.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/CHANGELOG

    r8518 r8523  
    77* Hash#symbolize_keys skips keys that can't be symbolized.  #10500 [Brad Greenlee] 
    88 
    9 * Ruby 1.9 compatibility.  #1689, #10466, #10468, #10554, #10632 [Cheah Chu Yeow, Pratik Naik, Jeremy Kemper, Dirkjan Bussink
     9* Ruby 1.9 compatibility.  #1689, #10466, #10468, #10554, #10594, #10632 [Cheah Chu Yeow, Pratik Naik, Jeremy Kemper, Dirkjan Bussink, fxn
    1010 
    1111* TimeZone#to_s uses UTC rather than GMT.  #1689 [Cheah Chu Yeow] 
  • trunk/activesupport/lib/active_support/basic_object.rb

    r8500 r8523  
    77      undef_method :== 
    88      undef_method :equal? 
     9 
     10      # Let ActiveSupport::BasicObject at least raise exceptions. 
     11      def raise(*args) 
     12        ::Object.send(:raise, *args) 
     13      end 
    914    end 
    1015  else 
  • trunk/activesupport/lib/active_support/duration.rb

    r8412 r8523  
    8383            end 
    8484          else 
    85             raise ArgumentError, "expected a time or date, got #{time.inspect}" 
     85            raise ::ArgumentError, "expected a time or date, got #{time.inspect}" 
    8686          end 
    8787        end 
  • trunk/activesupport/test/core_ext/duration_test.rb

    r8399 r8523  
    1919    assert_equal 1 + 1.second, 1.second + 1, "Duration + Numeric should == Numeric + Duration" 
    2020  end 
     21 
     22  def test_argument_error 
     23    begin 
     24      1.second.ago('') 
     25      flunk("no exception was raised") 
     26    rescue ArgumentError => e 
     27      assert_equal 'expected a time or date, got ""', e.message, "ensure ArgumentError is not being raised by dependencies.rb" 
     28    rescue Exception 
     29      flunk("ArgumentError should be raised, but we got #{$!.class} instead") 
     30    end 
     31  end 
    2132end