Sha256: f4d299c1d9a67abd6088ce52e57f54b8ea9ef2edcbd338f0d2e3e1800b198783

Contents?: true

Size: 803 Bytes

Versions: 5

Compression:

Stored size: 803 Bytes

Contents

# Stub to enable testing without Active Record
module ActiveRecord
  class Base
    def save!
    end
  end
end

require 'abstract_unit'
require 'active_support/whiny_nil'

class WhinyNilTest < Test::Unit::TestCase
  def test_unchanged
    nil.method_thats_not_in_whiners
  rescue NoMethodError => nme
    assert_match(/nil.method_thats_not_in_whiners/, nme.message)
  end

  def test_active_record
    nil.save!
  rescue NoMethodError => nme
    assert(!(nme.message =~ /nil:NilClass/))
    assert_match(/nil\.save!/, nme.message)
  end

  def test_array
    nil.each
  rescue NoMethodError => nme
    assert(!(nme.message =~ /nil:NilClass/))
    assert_match(/nil\.each/, nme.message)
  end

  def test_id
    nil.id
  rescue RuntimeError => nme
    assert(!(nme.message =~ /nil:NilClass/))
  end
end

Version data entries

5 entries across 4 versions & 3 rubygems

Version Path
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/activesupport/test/whiny_nil_test.rb
usher-0.7.0 spec/rails2_3/vendor/rails/vendor/rails/activesupport/test/whiny_nil_test.rb
recliner-0.0.1 vendor/activesupport/test/whiny_nil_test.rb
antfarm-0.3.0 rails/vendor/rails/activesupport/test/whiny_nil_test.rb
antfarm-0.4.0 rails/vendor/rails/activesupport/test/whiny_nil_test.rb