Class: ActiveSupport::TestCase — test-unit-activesupport - test-unit

Class: ActiveSupport::TestCase

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

Constant Summary

Assertion =

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

Test::Unit::AssertionFailedError

Instance Method Summary (collapse)

Instance Method Details

- (Object) message(msg = nil, ending = nil, &default)

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



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/test/unit/active_support.rb', line 47

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