Sha256: 4c07d968270a6eb46f844dcd5a65684cb2d41d4bd90efb0c3c04851436d463b2

Contents?: true

Size: 958 Bytes

Versions: 6

Compression:

Stored size: 958 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)
  class ActionController::TestCase
    include Draper::TestCase::ViewContextTeardown
  end
end

if defined?(ActionMailer::TestCase)
  class ActionMailer::TestCase
    include Draper::TestCase::ViewContextTeardown
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
draper_new-3.0.0 lib/draper/test_case.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/draper-2.1.0/lib/draper/test_case.rb
draper-2.1.0 lib/draper/test_case.rb
draper-2.0.0 lib/draper/test_case.rb
draper-1.4.0 lib/draper/test_case.rb
draper-1.3.1 lib/draper/test_case.rb