<commit_before>require "rails_helper"
include Warden::Test::Helpers

describe "Assessor feedback management", js: true do
  let(:assessor) { create(:assessor, :lead_for_all) }
  let!(:form_answer) { create(:form_answer, :innovation) }

  before do
    login_as(assessor, scope: :assessor)
  end

  describe "feedback submission" do
    it "submits feedback" do
      visit assessor_form_answer_path(form_answer)
      find("#feedback-heading a").click

      within "#section-feedback .level_of_innovation" do
        find("a.form-edit-link").click
        fill_in "feedback[level_of_innovation_strength]", with: "Feedback 101"
        click_button "Save"

        expect(page).to have_selector(".form-value", text: "Feedback 101")
      end
    end
  end

  describe "feedback approval" do
    it "approves submitted feedback" do
      feedback = form_answer.build_feedback
      feedback.submitted = true
      feedback.save!

      visit assessor_form_answer_path(form_answer)
      find("#feedback-heading a").click
      click_button "Approve feedback"

      expect(page).to have_no_selector(".btn-block", text: "Approve feedback")
    end
  end
end<commit_msg>[Random Specs] fixed spec/features/assessor/feedback_spec.rb (I hope =))<commit_after>require "rails_helper"
include Warden::Test::Helpers

describe "Assessor feedback management" do
  let(:assessor) { create(:assessor, :lead_for_all) }
  let!(:form_answer) { create(:form_answer, :innovation) }

  before do
    login_as(assessor, scope: :assessor)
  end

  describe "feedback submission" do
    it "submits feedback", js: true do
      visit assessor_form_answer_path(form_answer)
      find("#feedback-heading a").click

      within "#section-feedback .level_of_innovation" do
        find("a.form-edit-link").click
        fill_in "feedback[level_of_innovation_strength]", with: "Feedback 101"
        click_button "Save"

        expect(page).to have_selector(".form-value", text: "Feedback 101")
      end
    end
  end

  describe "feedback approval" do
    before do
      feedback = form_answer.build_feedback
      feedback.submitted = true
      feedback.save!

      form_answer.reload
    end

    it "approves submitted feedback", js: true do
      visit assessor_form_answer_path(form_answer)
      find("#feedback-heading a").click
      click_button "Approve feedback"

      expect(page).to have_no_selector(".btn-block", text: "Approve feedback")
    end
  end
end
{'fraction_non_alphanumeric': 0.10485516115871073, 'fraction_numerical': 0.004895960832313341, 'mean_word_length': 3.600375234521576, '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': '397838', 'n_tokens_mistral': 799, 'n_tokens_neox': 741, 'n_words': 179}