<commit_before>require "rails_helper"

module Renalware
  RSpec.describe DeathsController, type: :controller do

    subject { create(:patient) }

    before do
      @edta_code = FactoryGirl.create(:edta_code)
      @modality_code = FactoryGirl.create(:modality_code, :death)
      @patient_modality = FactoryGirl.create(:modality,
        patient_id: subject.id, modality_code_id: @modality_code.id)
    end

    describe "index" do
      it "responds with success" do
        get :index
        expect(response).to have_http_status(:success)
      end
    end

    describe "GET edit" do
      it "responds with success" do
        get :edit, patient_id: subject.id
        expect(response).to have_http_status(:success)
      end
    end

    describe "PUT update" do
      context "with valid attributes" do
        it "updates death details" do
          put :update,
          patient_id: subject.id,
          patient: {
            death_date: Date.parse(Time.now.to_s),
            first_edta_code_id: @edta_code.id
          }
          expect(response).to redirect_to(patient_path(subject))
        end
      end

      context "with invalid attributes" do
        it "updates death details" do
          put :update, patient_id: subject.id, patient: { death_date: nil }
          expect(response).to render_template(:edit)
        end
      end
    end
  end
end
<commit_msg>Amended wording of test within deaths_controller_spec.<commit_after>require "rails_helper"

module Renalware
  RSpec.describe DeathsController, type: :controller do

    subject { create(:patient) }

    before do
      @edta_code = FactoryGirl.create(:edta_code)
      @modality_code = FactoryGirl.create(:modality_code, :death)
      @patient_modality = FactoryGirl.create(:modality,
        patient_id: subject.id, modality_code_id: @modality_code.id)
    end

    describe "index" do
      it "responds with success" do
        get :index
        expect(response).to have_http_status(:success)
      end
    end

    describe "GET edit" do
      it "responds with success" do
        get :edit, patient_id: subject.id
        expect(response).to have_http_status(:success)
      end
    end

    describe "PUT update" do
      context "with valid attributes" do
        it "updates death details" do
          put :update,
          patient_id: subject.id,
          patient: {
            death_date: Date.parse(Time.now.to_s),
            first_edta_code_id: @edta_code.id
          }
          expect(response).to redirect_to(patient_path(subject))
        end
      end

      context "with invalid attributes" do
        it "fails to update death details" do
          put :update, patient_id: subject.id, patient: { death_date: nil }
          expect(response).to render_template(:edit)
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.08247787610619468, 'fraction_numerical': 0.0, 'mean_word_length': 2.3925570228091235, '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': '821852', 'n_tokens_mistral': 850, 'n_tokens_neox': 822, 'n_words': 221}