Created
October 11, 2013 00:42
-
-
Save amiel/6927952 to your computer and use it in GitHub Desktop.
Patch to https://github.com/drapergem/draper/blob/master/lib/draper/test_case.rb to prevent https://github.com/drapergem/draper/pull/569
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Draper | |
- begin | |
- require 'minitest/rails' | |
- rescue LoadError | |
- end | |
- | |
- active_support_test_case = begin | |
- require 'minitest/rails/active_support' # minitest-rails < 0.5 | |
- ::MiniTest::Rails::ActiveSupport::TestCase | |
- rescue LoadError | |
require 'active_support/test_case' | |
- ::ActiveSupport::TestCase | |
- end | |
- class TestCase < active_support_test_case | |
+ class TestCase < ::ActiveSupport::TestCase | |
module ViewContextTeardown | |
def teardown | |
super | |
Draper::ViewContext.clear! | |
end | |
end | |
module Behavior | |
if defined?(::Devise) | |
require 'draper/test/devise_helper' | |
include Draper::DeviseHelper | |
end | |
if defined?(::Capybara) && (defined?(::RSpec) || defined?(::MiniTest::Matchers)) | |
require 'capybara/rspec/matchers' | |
include ::Capybara::RSpecMatchers | |
end | |
include Draper::ViewHelpers::ClassMethods | |
alias_method :helper, :helpers | |
end | |
include Behavior | |
include ViewContextTeardown | |
end | |
end | |
if defined?(ActionController::TestCase) | |
class ActionController::TestCase | |
include Draper::TestCase::ViewContextTeardown | |
end | |
end | |
if defined?(ActionMailer::TestCase) | |
class ActionMailer::TestCase | |
include Draper::TestCase::ViewContextTeardown | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment