<commit_before>require 'rails_spec_helper'

RSpec.describe AssignmentExportsController, type: :controller do
  describe "GET submissions" do
    before(:each) { get :submissions, assignment_id: 5 }
  end

  describe "GET team_submissions" do
    before(:each) { get :team_submissions }

  end

  describe "submissions_response (protected)" do
    let(:controller_instance) { AssignmentExportsController.new }
    let(:submissions_response) { controller_instance.instance_eval { submissions_response }}

    context "job was successfully enqueued" do
      before(:each) { controller_instance.instance_variable_set(:@job_enqueued, true) }

      it "returns an okay status" do
        expect(submissions_response[:status]).to eq 200
      end

      it "returns a pleasant message" do
        expect(submissions_response[:status]).to match "Your archive is being prepared."
      end
    end

    context "job was not enqueued" do
      before(:each) { controller_instance.instance_variable_set(:@job_enqueued, false) }

      it "returns an error status" do
        expect(submissions_response[:status]).to eq 400
      end

      it "returns a forboding message" do
        expect(submissions_response[:status]).to match "Your archive failed to build."
      end
    end
  end
end
<commit_msg>fix bug in testing json response messages in assignment exports controller<commit_after>require 'rails_spec_helper'

RSpec.describe AssignmentExportsController, type: :controller do
  describe "GET submissions" do
    before(:each) { get :submissions, assignment_id: 5 }
  end

  describe "GET team_submissions" do
    before(:each) { get :team_submissions }

  end

  describe "submissions_response (protected)" do
    let(:controller_instance) { AssignmentExportsController.new }
    let(:submissions_response) { controller_instance.instance_eval { submissions_response }}

    context "job was successfully enqueued" do
      before(:each) { controller_instance.instance_variable_set(:@job_enqueued, true) }

      it "returns an okay status" do
        expect(submissions_response[:status]).to eq 200
      end

      it "returns a pleasant message" do
        expect(submissions_response[:json]).to match "Your archive is being prepared."
      end
    end

    context "job was not enqueued" do
      before(:each) { controller_instance.instance_variable_set(:@job_enqueued, false) }

      it "returns an error status" do
        expect(submissions_response[:status]).to eq 400
      end

      it "returns a forboding message" do
        expect(submissions_response[:json]).to match "Your archive failed to build."
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.08241965973534972, 'fraction_numerical': 0.005293005671077505, 'mean_word_length': 3.7334525939177103, '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': '6716168', 'n_tokens_mistral': 775, 'n_tokens_neox': 714, 'n_words': 218}