Skip to content

Commit

Permalink
Use load hook for minitest integration
Browse files Browse the repository at this point in the history
Unlike RSpec, Minitest doesn't load the Spec DSL when loaded by Bundler,
so loading the integration in the Railtie can be problematic.
Switch to a load hook so that the integration can be loaded whenever
minitest-rails is loaded, which it may not be during Draper initialization.
  • Loading branch information
blowmage committed May 20, 2014
1 parent 2e06692 commit 55ea318
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/draper/railtie.rb
Expand Up @@ -20,7 +20,6 @@ class Railtie < Rails::Railtie
if Rails.env.test?
require 'draper/test_case'
require 'draper/test/rspec_integration' if defined?(RSpec) and RSpec.respond_to?(:configure)
require 'draper/test/minitest_integration' if defined?(MiniTest::Rails)
end
end

Expand Down Expand Up @@ -50,6 +49,12 @@ class Railtie < Rails::Railtie
end
end

initializer "draper.minitest-rails_integration" do |app|
ActiveSupport.on_load :minitest do
require "draper/test/minitest_integration"
end
end

console do
require 'action_controller/test_case'
ApplicationController.new.view_context
Expand Down

0 comments on commit 55ea318

Please sign in to comment.