Sha256: f75f5d61ded2b3d2fc4aa220872f784e0eba87890f1bf0a5c2b493e60a226464

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require "minispec/rails/version"
require 'minitest/spec'

module Minispec
  module Rails

    # Default test will be subclass of ActiveSupport::TestCase.
    Minitest::Spec::TYPES.clear
    Minitest::Spec.register_spec_type(//, ActiveSupport::TestCase)

    # We can't force ActiveSupport to be a subclass of Minitest::Spec.
    # Next best thing.
    ActiveSupport::TestCase.extend Minitest::Spec::DSL

    ActiveSupport.on_load(:action_dispatch_integration_test) do
      Minitest::Spec.register_spec_type(ActionDispatch::IntegrationTest) do |desc|
        (desc.is_a?(Class) && desc < AbstractController::Base) ||
          (desc.to_s =~ /integration$/i)
      end
    end

    ActiveSupport.on_load(:active_job) do
      Minitest::Spec.register_spec_type(ActiveJob::TestCase) do |desc|
        desc.is_a?(Class) && desc < ActiveJob::Base
      end
    end

    ActiveSupport.on_load(:action_mailer_test_case) do
      Minitest::Spec.register_spec_type(ActionMailer::TestCase) do |desc|
        desc.is_a?(Class) && desc < ActionMailer::Base
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
minispec-rails-0.3.0 lib/minispec/rails.rb