<commit_before>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<commit_msg>Move view context clear to before_setup (minitest) (#839)<commit_after>module Draper
  require 'active_support/test_case'

  class TestCase < ::ActiveSupport::TestCase
    module ViewContextTeardown
      def before_setup
        Draper::ViewContext.clear!
        super
      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
{'fraction_non_alphanumeric': 0.08986486486486486, 'fraction_numerical': 0.002027027027027027, 'mean_word_length': 2.9598930481283423, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2814296', 'n_tokens_mistral': 449, 'n_tokens_neox': 435, 'n_words': 94}