<commit_before>require 'spec_helper'
require 'pakyow/core/middleware/www_enforcer'

describe Pakyow::Middleware::WWWEnforcer do
  let :app do
    double
  end

  let :instance do
    Pakyow::Middleware::WWWEnforcer.new(app)
  end

  let :env do
    {
      'SERVER_NAME' => host,
      'REQUEST_METHOD' => method
    }
  end

  let :host do
    'pakyow.com'
  end

  let :host_www do
    'www.pakyow.com'
  end

  let :host_subdomain do
    'foo.pakyow.com'
  end

  let :method do
    'GET'
  end

  before do
    allow(app).to receive(:enforce_www) { true }
    allow(Pakyow).to receive(:app).and_return(app)
    allow(app).to receive(:call)
  end
<commit_msg>Fix failed www_enforcer spec<commit_after>require 'spec_helper'
require 'pakyow/core/middleware/www_enforcer'

describe Pakyow::Middleware::WWWEnforcer do
  let :app do
    double
  end

  let :instance do
    Pakyow::Middleware::WWWEnforcer.new(app)
  end

  let :env do
    {
      'SERVER_NAME' => host,
      'REQUEST_METHOD' => method
    }
  end

  let :host do
    'pakyow.com'
  end

  let :host_www do
    'www.pakyow.com'
  end

  let :host_subdomain do
    'foo.pakyow.com'
  end

  let :method do
    'GET'
  end

  before do
    allow(app).to receive(:enforce_www) { true }
    allow(Pakyow).to receive(:app).and_return(app)
    allow(app).to receive(:call)
    Pakyow::App.instance_variable_set(:@builder, double(Rack::Builder).as_null_object)
  end

{'fraction_non_alphanumeric': 0.11430575035063113, 'fraction_numerical': 0.0, 'mean_word_length': 3.053977272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 9, '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': '6536384', 'n_tokens_mistral': 558, 'n_tokens_neox': 545, 'n_words': 115}