<commit_before>require 'rails_helper'

module Memberful
  RSpec.describe WebHooksController, type: :controller do
    routes { Memberful::Engine.routes }

    describe 'create' do
      let(:params) { JSON.parse(File.read('./spec/fixtures/order.completed.json')) }

      it 'finds the user' do
        allow(JSON).to receive(:parse).and_return(params)
        expect(User).to receive(:find_by_email).with('<EMAIL>')
        post :create
      end
    end

    describe '/status' do
      before { get :status }
<commit_msg>controller spec sends data to :create<commit_after>require 'rails_helper'

module Memberful
  RSpec.describe WebHooksController, type: :controller do
    routes { Memberful::Engine.routes }

    describe 'create' do
      let(:data) { File.read('./spec/fixtures/order.completed.json') }
      let(:headers) { { 'CONTENT_TYPE': 'application/x-www-form-urlencoded' } }

      it 'finds the user' do
        expect(User).to receive(:find_by_email).with('<EMAIL>')
        post :create, data, headers
      end
    end

    describe '/status' do
      before { get :status }

{'fraction_non_alphanumeric': 0.12694063926940638, 'fraction_numerical': 0.0, 'mean_word_length': 3.1515151515151514, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '1689091', 'n_tokens_mistral': 340, 'n_tokens_neox': 331, 'n_words': 78}