diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index 20cc5c64f..cd99837e6 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -25,7 +25,7 @@ class CaseLogsController < ApplicationController end def update - if case_log = CaseLog.find_by(id: params[:id]) + if (case_log = CaseLog.find_by(id: params[:id])) if case_log.update(api_case_log_params) render json: case_log, status: :ok else @@ -64,7 +64,7 @@ class CaseLogsController < ApplicationController end def destroy - if case_log = CaseLog.find_by(id: params[:id]) + if (case_log = CaseLog.find_by(id: params[:id])) if case_log.discard head :no_content else diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 30a2b3980..64c1cdb95 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -58,16 +58,16 @@ class CaseLog < ApplicationRecord status == "in_progress" end - private +private def update_status! self.status = if all_fields_completed? && errors.empty? - "completed" - elsif all_fields_nil? - "not_started" - else - "in_progress" - end + "completed" + elsif all_fields_nil? + "not_started" + else + "in_progress" + end end def all_fields_completed? diff --git a/app/models/form_handler.rb b/app/models/form_handler.rb index c6cd755d4..4e8bee80b 100644 --- a/app/models/form_handler.rb +++ b/app/models/form_handler.rb @@ -12,8 +12,8 @@ class FormHandler @forms[form] ||= Form.new(form) end +private - private def get_all_forms forms = {} directories = ["config/forms", "spec/fixtures/forms"] diff --git a/spec/requests/case_log_controller_spec.rb b/spec/requests/case_log_controller_spec.rb index a1c552a52..e02329f04 100644 --- a/spec/requests/case_log_controller_spec.rb +++ b/spec/requests/case_log_controller_spec.rb @@ -128,7 +128,7 @@ RSpec.describe CaseLogsController, type: :request do end context "invalid case log params" do - let(:params) { {tenant_age: 200} } + let(:params) { { tenant_age: 200 } } it "returns 422" do expect(response).to have_http_status(:unprocessable_entity)