Changeset 7117
- Timestamp:
- 06/25/07 18:22:31 (2 years ago)
- Files:
-
- trunk/activesupport/test/clean_logger_test.rb (modified) (1 diff)
- trunk/activesupport/test/core_ext/blank_test.rb (modified) (1 diff)
- trunk/activesupport/test/core_ext/class_test.rb (modified) (1 diff)
- trunk/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb (modified) (1 diff)
- trunk/activesupport/test/core_ext/numeric_ext_test.rb (modified) (1 diff)
- trunk/activesupport/test/json/decoding_test.rb (modified) (1 diff)
- trunk/activesupport/test/time_zone_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/test/clean_logger_test.rb
r7083 r7117 46 46 @logger.datetime_format = "%Y-%m-%d" 47 47 @logger.debug 'debug' 48 assert_equal "%Y-%m-%d", @logger.datetime_format 48 49 assert_match(/D, \[\d\d\d\d-\d\d-\d\d#\d+\] DEBUG -- : debug/, @out.string) 49 50 end trunk/activesupport/test/core_ext/blank_test.rb
r4595 r7117 4 4 BLANK = [nil, false, '', ' ', " \n\t \r ", [], {}] 5 5 NOT = [true, 0, 1, 'a', [nil], { nil => 0 }] 6 7 class EmptyObject 8 def empty? 9 true 10 end 11 alias :strip :empty? 12 end 13 class NoStripObject < EmptyObject; undef :strip; end 14 class NoEmptyStripObject < NoStripObject; undef :empty?; end 6 15 7 16 def test_blank 8 17 BLANK.each { |v| assert v.blank? } 9 18 NOT.each { |v| assert !v.blank? } 19 assert EmptyObject.new.blank? 20 assert NoStripObject.new.blank? 21 assert !NoEmptyStripObject.new.blank? 10 22 end 11 23 end trunk/activesupport/test/core_ext/class_test.rb
r4595 r7117 34 34 assert_raises(NameError) { Y::Z::C.is_a?(Class) } 35 35 end 36 37 def test_retrieving_subclasses 38 @parent = eval("class D; end; D") 39 @sub = eval("class E < D; end; E") 40 @subofsub = eval("class F < E; end; F") 41 assert @parent.subclasses.all? { |i| [@sub.to_s, @subofsub.to_s].include?(i) } 42 assert_equal 2, @parent.subclasses.size 43 assert_equal [@subofsub.to_s], @sub.subclasses 44 assert_equal [], @subofsub.subclasses 45 end 36 46 end trunk/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
r6050 r7117 206 206 assert_equal 0, @klass.a.keys.size 207 207 end 208 209 def test_reset_inheritable_attributes 210 @klass.class_inheritable_accessor :a 211 @klass.a = 'a' 212 213 @sub = eval("class Inheriting < @klass; end; Inheriting") 214 215 assert_equal 'a', @klass.a 216 assert_equal 'a', @sub.a 217 218 @klass.reset_inheritable_attributes 219 @sub = eval("class NotInheriting < @klass; end; NotInheriting") 220 221 assert_equal nil, @klass.a 222 assert_equal nil, @sub.a 223 end 208 224 end trunk/activesupport/test/core_ext/numeric_ext_test.rb
r6937 r7117 105 105 def test_unit_in_terms_of_another 106 106 relationships = { 107 1024.bytes => 1.kilobyte, 107 108 1024.kilobytes => 1.megabyte, 108 109 3584.0.kilobytes => 3.5.megabytes, trunk/activesupport/test/json/decoding_test.rb
r6443 r7117 26 26 end 27 27 end 28 29 def test_failed_json_decoding 30 assert_raises(ActiveSupport::JSON::ParseError) { ActiveSupport::JSON.decode(%({: 1})) } 31 end 28 32 end trunk/activesupport/test/time_zone_test.rb
r4595 r7117 81 81 assert_nil TimeZone["bogus"] 82 82 assert_not_nil TimeZone["Central Time (US & Canada)"] 83 assert_not_nil TimeZone[8] 84 assert_raises(ArgumentError) { TimeZone[false] } 83 85 end 84 86 85 87 def test_new 86 88 a = TimeZone.new("Berlin") … … 89 91 assert_nil TimeZone.new("bogus") 90 92 end 93 94 def test_us_zones 95 assert TimeZone.us_zones.include?(TimeZone["Hawaii"]) 96 assert !TimeZone.us_zones.include?(TimeZone["Kuala Lumpur"]) 97 end 91 98 end