<commit_before># frozen_string_literal: true

require "rails_helper"

describe Settings::ExportController, type: :controller do
  describe "#index" do
    subject { get :index }

    context "user signed in" do
      let(:user) { FactoryBot.create(:user) }

      before { sign_in user }

      it "renders the index template" do
        subject
        expect(response).to render_template(:index)
      end
    end
  end
end
<commit_msg>Add tests for `ExportController#create`<commit_after># frozen_string_literal: true

require "rails_helper"

describe Settings::ExportController, type: :controller do
  describe "#index" do
    subject { get :index }

    context "user signed in" do
      let(:user) { FactoryBot.create(:user) }

      before { sign_in user }

      it "renders the index template" do
        subject
        expect(response).to render_template(:index)
      end
    end
  end

  describe "#create" do
    subject { post :create }

    context "user signed in" do
      let(:user) { FactoryBot.create(:user) }

      before { sign_in user }

      it "enqueues an ExportWorker job" do
        subject
        expect(ExportWorker).to have_enqueued_sidekiq_job(user.id)
      end
      
      it "redirects to the export page" do
        subject
        expect(response).to redirect_to(:settings_export)
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.08586232420429311, 'fraction_numerical': 0.0, 'mean_word_length': 2.7142857142857144, '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': '7481843', 'n_tokens_mistral': 404, 'n_tokens_neox': 388, 'n_words': 120}