Browse Source

Linting

pull/51/head
baarkerlounger 3 years ago
parent
commit
5248a96db3
  1. 4
      app/controllers/case_logs_controller.rb
  2. 14
      app/models/case_log.rb
  3. 2
      app/models/form_handler.rb
  4. 2
      spec/requests/case_log_controller_spec.rb

4
app/controllers/case_logs_controller.rb

@ -25,7 +25,7 @@ class CaseLogsController < ApplicationController
end end
def update 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) if case_log.update(api_case_log_params)
render json: case_log, status: :ok render json: case_log, status: :ok
else else
@ -64,7 +64,7 @@ class CaseLogsController < ApplicationController
end end
def destroy def destroy
if case_log = CaseLog.find_by(id: params[:id]) if (case_log = CaseLog.find_by(id: params[:id]))
if case_log.discard if case_log.discard
head :no_content head :no_content
else else

14
app/models/case_log.rb

@ -58,16 +58,16 @@ class CaseLog < ApplicationRecord
status == "in_progress" status == "in_progress"
end end
private private
def update_status! def update_status!
self.status = if all_fields_completed? && errors.empty? self.status = if all_fields_completed? && errors.empty?
"completed" "completed"
elsif all_fields_nil? elsif all_fields_nil?
"not_started" "not_started"
else else
"in_progress" "in_progress"
end end
end end
def all_fields_completed? def all_fields_completed?

2
app/models/form_handler.rb

@ -12,8 +12,8 @@ class FormHandler
@forms[form] ||= Form.new(form) @forms[form] ||= Form.new(form)
end end
private
private
def get_all_forms def get_all_forms
forms = {} forms = {}
directories = ["config/forms", "spec/fixtures/forms"] directories = ["config/forms", "spec/fixtures/forms"]

2
spec/requests/case_log_controller_spec.rb

@ -128,7 +128,7 @@ RSpec.describe CaseLogsController, type: :request do
end end
context "invalid case log params" do context "invalid case log params" do
let(:params) { {tenant_age: 200} } let(:params) { { tenant_age: 200 } }
it "returns 422" do it "returns 422" do
expect(response).to have_http_status(:unprocessable_entity) expect(response).to have_http_status(:unprocessable_entity)

Loading…
Cancel
Save