Sha256: afcbd8e997619d093235951ce99aa402e7fd3e910c5049ca9b11407036a076d1

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

module Draper
  require '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
  ActionController::TestCase.include Draper::TestCase::ViewContextTeardown
end

if defined? ActionMailer::TestCase
  ActionMailer::TestCase.include Draper::TestCase::ViewContextTeardown
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
draper-3.0.1 lib/draper/test_case.rb
draper-3.0.0 lib/draper/test_case.rb
draper-3.0.0.pre1 lib/draper/test_case.rb