Sha256: ad9500d2b6787c69ab33d1d44267cc6a1b9d1e5a514384a4a93bd37b966cbf01

Contents?: true

Size: 987 Bytes

Versions: 2

Compression:

Stored size: 987 Bytes

Contents

# :enddoc:

include Shoulda::Callback::Matchers::RailsVersionHelper

# in environments where test/unit is not required, this is necessary
unless defined?(Test::Unit::TestCase)
  begin
    require rails_version >= '4.1' ? 'minitest' : 'test/unit/testcase'
  rescue LoadError
    # silent
  end
end

if defined?(Test::Unit::TestCase) && (defined?(::ActiveModel) || defined?(::ActiveRecord))
  require 'shoulda/callback/matchers/active_model'

  Test::Unit::TestCase.tap do |test_unit|
    test_unit.send :include, Shoulda::Callback::Matchers::ActiveModel
    test_unit.send :extend, Shoulda::Callback::Matchers::ActiveModel
  end

elsif defined?(MiniTest::Unit::TestCase) && (defined?(::ActiveModel) || defined?(::ActiveRecord))
  require 'shoulda/callback/matchers/active_model'

  MiniTest::Unit::TestCase.tap do |minitest_unit|
    minitest_unit.send :include, Shoulda::Callback::Matchers::ActiveModel
    minitest_unit.send :extend, Shoulda::Callback::Matchers::ActiveModel
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoulda-callback-matchers-1.1.4 lib/shoulda/callback/matchers/integrations/test_unit.rb
shoulda-callback-matchers-1.1.3 lib/shoulda/callback/matchers/integrations/test_unit.rb