Sha256: 1e6d5da367e605f19d1feba6a50f4bb7ee90031ee691f8927ba19df0a2025e6e

Contents?: true

Size: 1000 Bytes

Versions: 2

Compression:

Stored size: 1000 Bytes

Contents

if defined?(ActiveSupport::TestCase)
  class << ActiveSupport::TestCase
    remove_method :describe
  end

  MiniTest::Spec.register_spec_type ActiveSupport::TestCase do |desc|
    desc.respond_to?(:ancestors) && !(desc.ancestors.map(&:to_s) & ["ActiveRecord::Base", "Mongoid::Document", "MongoMapper::Document", "DataMapper::Resource"]).empty?
  end
end

if defined?(ActionController::TestCase)
  class ActionController::TestCase
    def self.determine_default_controller_class(name)
      if name.match(/.*(?:^|::)(\w+Controller)/)
        $1.constantize rescue nil
      else
        super(name)
      end
    end

    before { setup_controller_request_and_response }
  end

  MiniTest::Spec.register_spec_type /Controller/, ActionController::TestCase
end

if defined?(ActionController::IntegrationTest)
  class ActionController::IntegrationTest
    before { self.class.app = Rails.application }
  end

  MiniTest::Spec.register_spec_type /Integration Test$/, ActionController::IntegrationTest
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
minitest-spec-rails-3.0.7 lib/minitest-spec-rails/test_case.rb
minitest-spec-rails-3.0.6 lib/minitest-spec-rails/test_case.rb