<commit_before>require "spec_helper"
require "kushojin/controller_methods/send_change_filter"

RSpec.describe Kushojin::ControllerMethods::SendChangeFilter do
  describe "#around" do
    let(:logger) { Fluent::Logger::TestLogger.new }
    let(:callback) do
      sender = Kushojin::Sender::EachSender.new(logger)
      Kushojin::ControllerMethods::SendChangeFilter.new(sender: sender)
    end

    before do
      controller = double(:UsersController)
      req = double("ActionDispatch::Request")

      allow(controller).to receive_messages(
        controller_name: "users",
        action_name:     "action",
        request:         req,
      )
      allow(req).to receive(:request_id).and_return("12345678-9abc-def0-1234-56789abcdef0")

      callback.around(controller) do
        user = User.create(name: "bill", age: 20)
        user.update(name: "bob")
      end<commit_msg>Remove all records to independency of test<commit_after>require "spec_helper"
require "kushojin/controller_methods/send_change_filter"

RSpec.describe Kushojin::ControllerMethods::SendChangeFilter do
  describe "#around" do
    let(:logger) { Fluent::Logger::TestLogger.new }
    let(:callback) do
      sender = Kushojin::Sender::EachSender.new(logger)
      Kushojin::ControllerMethods::SendChangeFilter.new(sender: sender)
    end

    before do
      controller = double(:UsersController)
      req = double("ActionDispatch::Request")

      allow(controller).to receive_messages(
        controller_name: "users",
        action_name:     "action",
        request:         req,
      )
      allow(req).to receive(:request_id).and_return("12345678-9abc-def0-1234-56789abcdef0")

      callback.around(controller) do
        user = User.create(name: "bill", age: 20)
        user.update(name: "bob")
      end
    end

    after do
      User.delete_all
{'fraction_non_alphanumeric': 0.1144872490504612, 'fraction_numerical': 0.02387411828540423, 'mean_word_length': 3.422062350119904, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5830916', 'n_tokens_mistral': 583, 'n_tokens_neox': 541, 'n_words': 99}