Class: ActiveSupport::TestCase

Inherits:
Test::Unit::TestCase
  • Object
show all
Includes:
ActiveSupport::Testing::Assertions, ActiveSupport::Testing::FileFixtures, ActiveSupport::Testing::TaggedLogging
Defined in:
lib/test/unit/active_support.rb

Constant Summary collapse

Assertion =

shoulda needs ActiveSupport::TestCase::Assertion, which is not set in test-unit 3

Test::Unit::AssertionFailedError

Instance Method Summary collapse

Instance Method Details

#after_teardownObject



66
67
# File 'lib/test/unit/active_support.rb', line 66

def after_teardown
end

#before_setupObject



62
63
# File 'lib/test/unit/active_support.rb', line 62

def before_setup
end

#message(msg = nil, ending = nil, &default) ⇒ Object

rails 4.1 (action dispatch assertions) needs the ‘message’ method which is not defined in test-unit 3



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/test/unit/active_support.rb', line 71

def message(msg=nil, ending=nil, &default)
  lambda do
    msg = msg.call if msg.respond_to?(:call)
    msg = msg.to_s.chomp(".") unless msg.nil?
    if msg.nil? or msg.empty?
      custom_message = ""
    else
      custom_message = "#{msg}.\n"
    end
    ending ||= "."
    "#{custom_message}#{default.call}#{ending}"
  end
end