<commit_before>module RouteDog
  module Middleware
    class Notifier < RouteDog
      def initialize(app)
        @app = app
        super
      end

      def call(env)
        @env = env

        status, headers, @response = @app.call(env)

        append_warning if !route_tested?

        [status, headers, @response]
      end

      def append_warning
        @response.each do |part|
          part.gsub!("<body>", "<body>#{warning_html}")
        end
      end

      def warning_html
        <<-EOT
          <div style="display: block; height:70px;"></div>
          <div id="route_dog_warning" style="display: block; width: 100%; height: 70px; text-align: center; margin:0; position:absolute; top:0; background: red; font-size: 18px; font-weight: bold">
            <h1 style="color: #fff; font-size: 20px; margin: 20px 0 35px">The Route -- Has Not Integrational Tests!</h1>
          </div>
        EOT
      end
    end<commit_msg>add the route description when notify a not tested route<commit_after>module RouteDog
  module Middleware
    class Notifier < RouteDog
      def initialize(app)
        @app = app
        super
      end

      def call(env)
        @env = env

        status, headers, @response = @app.call(env)

        append_warning if !route_tested?

        [status, headers, @response]
      end

      def append_warning
        @response.each do |part|
          part.gsub!("<body>", "<body>#{warning_html}")
        end
      end

      def no_test_message
        "The Route #{request_method.to_s.upcase} #{identify_controller.to_s}##{identify_action.to_s} -- Has Not Integrational Tests!"
      end

      def warning_html
        <<-EOT
          <div style="display: block; height:70px;"></div>
          <div id="route_dog_warning" style="display: block; width: 100%; height: 70px; text-align: center; margin:0; position:absolute; top:0; background: red; font-size: 18px; font-weight: bold">
            <h1 style="color: #fff; font-size: 20px; margin: 20px 0 35px">#{no_test_message}</h1>
          </div>
        EOT
      end
    end
{'fraction_non_alphanumeric': 0.11869293608841903, 'fraction_numerical': 0.019221528111484865, 'mean_word_length': 2.3100158982511925, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 19, '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': '7469754', 'n_tokens_mistral': 678, 'n_tokens_neox': 633, 'n_words': 176}