1 # Stub to enable testing without Active Record
9 require 'abstract_unit'
10 require 'active_support/whiny_nil'
12 class WhinyNilTest < Test::Unit::TestCase
14 nil.method_thats_not_in_whiners
15 rescue NoMethodError => nme
16 assert(nme.message =~ /nil:NilClass/)
19 def test_active_record
21 rescue NoMethodError => nme
22 assert(!(nme.message =~ /nil:NilClass/))
23 assert_match(/nil\.save!/, nme.message)
28 rescue NoMethodError => nme
29 assert(!(nme.message =~ /nil:NilClass/))
30 assert_match(/nil\.each/, nme.message)
35 rescue RuntimeError => nme
36 assert(!(nme.message =~ /nil:NilClass/))
39 def test_no_to_ary_coercion
41 rescue NoMethodError => nme
42 assert(nme.message =~ /nil:NilClass/)
45 def test_no_to_str_coercion
47 rescue NoMethodError => nme
48 assert(nme.message =~ /nil:NilClass/)