Skip to content

Commit 2f1206b

Browse files
Fix StandardRB linting issues
- Auto-corrected Ruby style issues - Applied standardrb --fix [Automated daily update]
1 parent 397a3f4 commit 2f1206b

File tree

10 files changed

+94
-63
lines changed

10 files changed

+94
-63
lines changed

app/models/assessments/slide_assessment.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def required_runout_length
6666
)
6767
end
6868

69-
7069
sig { returns(T::Boolean) }
7170
def meets_wall_height_requirements?
7271
return false unless slide_platform_height.present? &&

spec/controllers/guides_controller_spec.rb

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@
77
controller = GuidesController.new
88
test_guides = [{title: "Test Guide", path: "test"}]
99
allow(controller).to receive(:collect_guides).and_return(test_guides)
10-
10+
1111
# Simulate what the index action does
1212
controller.index
1313
expect(controller.instance_variable_get(:@guides)).to eq(test_guides)
1414
end
1515
end
16-
16+
1717
describe "#collect_guides" do
1818
it "collects and sorts guides from metadata files" do
1919
controller = GuidesController.new
20-
20+
2121
# Mock file system
2222
allow(Dir).to receive(:glob).and_return([
2323
"/path/zebra_guide/metadata.json",
2424
"/path/alpha_guide/metadata.json"
2525
])
26-
26+
2727
metadata = {
2828
"screenshots" => [{"filename" => "test.png", "caption" => "Test"}],
2929
"updated_at" => "2024-01-15T10:00:00Z"
3030
}
3131
allow(File).to receive(:read).and_return(metadata.to_json)
32-
32+
3333
# Mock Pathname operations - first path is zebra, second is alpha
3434
# But they should be sorted alphabetically after collection
3535
allow_any_instance_of(Pathname).to receive(:relative_path_from) do |path|
@@ -39,41 +39,41 @@
3939
instance_double(Pathname, dirname: instance_double(Pathname, to_s: "alpha_guide"))
4040
end
4141
end
42-
42+
4343
guides = controller.send(:collect_guides)
4444
expect(guides.length).to eq(2)
4545
# After sorting by title, alpha should come first
4646
expect(guides.first[:title]).to eq("Alpha guide")
4747
expect(guides.last[:title]).to eq("Zebra guide")
4848
end
49-
49+
5050
it "returns empty array when no guides exist" do
5151
controller = GuidesController.new
5252
allow(Dir).to receive(:glob).and_return([])
53-
53+
5454
guides = controller.send(:collect_guides)
5555
expect(guides).to eq([])
5656
end
5757
end
58-
58+
5959
describe "GET #show" do
6060
let(:guide_path) { "test_guide" }
61-
61+
6262
before do
6363
# Skip n_plus_one_detection and stub render/redirect to avoid template rendering issues
6464
allow(controller).to receive(:n_plus_one_detection).and_yield
6565
allow(controller).to receive(:render)
6666
allow(controller).to receive(:redirect_to)
6767
end
68-
68+
6969
context "when metadata file exists" do
7070
let(:metadata) do
7171
{
7272
"screenshots" => [{"filename" => "test.png", "caption" => "Test"}],
7373
"updated_at" => "2024-01-15T10:00:00Z"
7474
}
7575
end
76-
76+
7777
before do
7878
metadata_file = instance_double(Pathname)
7979
allow(metadata_file).to receive(:exist?).and_return(true)
@@ -82,23 +82,23 @@
8282
instance_double(Pathname, join: metadata_file)
8383
)
8484
end
85-
85+
8686
it "assigns guide data when metadata exists" do
87-
get :show, params: { path: guide_path }
87+
get :show, params: {path: guide_path}
8888
expect(assigns(:guide_data)).to eq(metadata)
8989
end
90-
90+
9191
it "assigns guide path" do
92-
get :show, params: { path: guide_path }
92+
get :show, params: {path: guide_path}
9393
expect(assigns(:guide_path)).to eq(guide_path)
9494
end
95-
95+
9696
it "assigns humanized guide title" do
97-
get :show, params: { path: guide_path }
97+
get :show, params: {path: guide_path}
9898
expect(assigns(:guide_title)).to eq("Test guide")
9999
end
100100
end
101-
101+
102102
context "when metadata file does not exist" do
103103
before do
104104
metadata_file = instance_double(Pathname)
@@ -109,21 +109,21 @@
109109
# Don't stub redirect_to for these tests
110110
allow(controller).to receive(:render)
111111
end
112-
112+
113113
it "redirects to guides path when metadata doesn't exist" do
114114
allow(controller).to receive(:redirect_to).and_call_original
115-
get :show, params: { path: guide_path }
115+
get :show, params: {path: guide_path}
116116
expect(response).to redirect_to(guides_path)
117117
end
118-
118+
119119
it "sets flash alert when guide not found" do
120120
allow(controller).to receive(:redirect_to).and_call_original
121-
get :show, params: { path: guide_path }
121+
get :show, params: {path: guide_path}
122122
expect(flash[:alert]).to eq(I18n.t("guides.messages.not_found"))
123123
end
124124
end
125125
end
126-
126+
127127
describe "private methods" do
128128
describe "#guide_screenshots_root" do
129129
it "returns the correct path" do
@@ -132,17 +132,17 @@
132132
expect(controller.send(:guide_screenshots_root)).to eq(expected_path)
133133
end
134134
end
135-
135+
136136
describe "#humanize_guide_title" do
137137
it "removes _spec suffix and humanizes" do
138138
controller = GuidesController.new
139139
expect(controller.send(:humanize_guide_title, "test_workflow_spec")).to eq("Test workflow")
140140
end
141-
141+
142142
it "handles nested paths" do
143143
controller = GuidesController.new
144144
expect(controller.send(:humanize_guide_title, "features/admin/user_management")).to eq("User management")
145145
end
146146
end
147147
end
148-
end
148+
end

spec/models/inspection_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@
229229
it "handles end date correctly with DateTime fields" do
230230
# Date ranges with DateTime columns only include times before midnight of end date + 1
231231
on_end_early = create(:inspection, inspection_date: Time.zone.local(2024, 1, 30, 23, 59, 59))
232-
after_end = create(:inspection, inspection_date: Time.zone.local(2024, 1, 31, 0, 0, 1))
233-
232+
create(:inspection, inspection_date: Time.zone.local(2024, 1, 31, 0, 0, 1))
233+
234234
result = Inspection.filter_by_date_range(start_date, end_date)
235235
expect(result).to include(on_end_early)
236236
# Note: Rails Date ranges exclude times on the end date itself for DateTime fields

spec/requests/errors_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,4 @@
135135
end
136136
end
137137
end
138-
end
138+
end

spec/requests/inspections/inspections_spec.rb

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def mock_failing_update(error_messages = ["Update error"])
413413

414414
inspection.reload
415415
expect(inspection.unit).to eq(unit1)
416-
416+
417417
# Verify event logging
418418
event = Event.for_resource(inspection).last
419419
expect(event.action).to eq("unit_changed")
@@ -424,7 +424,6 @@ def mock_failing_update(error_messages = ["Update error"])
424424
patch "/inspections/#{inspection.id}/update_unit", params: {unit_id: "invalid"}
425425
expect_redirect_with_alert(select_unit_inspection_path(inspection), /invalid.*unit/i)
426426
end
427-
428427
end
429428
end
430429

@@ -495,7 +494,7 @@ def mock_failing_update(error_messages = ["Update error"])
495494

496495
describe "HEAD requests" do
497496
let(:inspection) { create(:inspection, user: user, unit: unit) }
498-
497+
499498
it "returns 200 OK for HEAD request" do
500499
head "/inspections/#{inspection.id}"
501500
expect(response).to have_http_status(:ok)
@@ -505,7 +504,7 @@ def mock_failing_update(error_messages = ["Update error"])
505504

506505
describe "GET /log" do
507506
let(:inspection) { create(:inspection, user: user, unit: unit) }
508-
507+
509508
before do
510509
# Create some events for the inspection
511510
Event.log(
@@ -532,7 +531,6 @@ def mock_failing_update(error_messages = ["Update error"])
532531
end
533532
end
534533

535-
536534
describe "prefill functionality" do
537535
let(:previous_inspection) do
538536
create(:inspection, :completed,
@@ -552,8 +550,8 @@ def mock_failing_update(error_messages = ["Update error"])
552550

553551
describe "translate_field_name" do
554552
it "translates field names for prefill display" do
555-
get "/inspections/#{new_inspection.id}/edit", params: { tab: "inspection" }
556-
553+
get "/inspections/#{new_inspection.id}/edit", params: {tab: "inspection"}
554+
557555
expect(response).to have_http_status(:success)
558556
# The prefilled_fields will be set if there are fields to prefill
559557
expect(assigns(:prefilled_fields)).to be_an(Array)
@@ -565,9 +563,9 @@ def mock_failing_update(error_messages = ["Update error"])
565563
containing_wall_height: 100,
566564
containing_wall_height_comment: "Test comment"
567565
)
568-
569-
get "/inspections/#{new_inspection.id}/edit", params: { tab: "user_height" }
570-
566+
567+
get "/inspections/#{new_inspection.id}/edit", params: {tab: "user_height"}
568+
571569
expect(response).to have_http_status(:success)
572570
expect(assigns(:previous_inspection)).to eq(previous_inspection)
573571
# Prefilled fields would include the ground_clearance fields
@@ -593,7 +591,7 @@ def mock_failing_update(error_messages = ["Update error"])
593591

594592
describe "validate_tab_parameter" do
595593
let(:inspection) { create(:inspection, user: user, unit: unit) }
596-
594+
597595
it "redirects with invalid tab parameter" do
598596
get "/inspections/#{inspection.id}/edit", params: {tab: "invalid_tab"}
599597

@@ -642,12 +640,12 @@ def mock_failing_update(error_messages = ["Update error"])
642640

643641
describe "calculate_changes" do
644642
let(:inspection) { create(:inspection, user: user, unit: unit) }
645-
643+
646644
it "tracks changes correctly in update" do
647645
# Store original values
648646
original_passed = inspection.passed
649-
original_risk = inspection.risk_assessment
650-
647+
inspection.risk_assessment
648+
651649
patch "/inspections/#{inspection.id}", params: {
652650
inspection: {
653651
passed: !original_passed,
@@ -656,7 +654,7 @@ def mock_failing_update(error_messages = ["Update error"])
656654
}
657655

658656
expect(response).to redirect_to(inspection_path(inspection))
659-
657+
660658
# Check the event was logged with changed data
661659
event = Event.for_resource(inspection).last
662660
expect(event.action).to eq("updated")
@@ -666,8 +664,8 @@ def mock_failing_update(error_messages = ["Update error"])
666664
end
667665

668666
it "ignores unchanged values" do
669-
original_value = inspection.risk_assessment
670-
667+
inspection.risk_assessment
668+
671669
patch "/inspections/#{inspection.id}", params: {
672670
inspection: {
673671
risk_assessment: "New risk",
@@ -676,7 +674,7 @@ def mock_failing_update(error_messages = ["Update error"])
676674
}
677675

678676
expect(response).to redirect_to(inspection_path(inspection))
679-
677+
680678
# Check that only changed fields are in changed_data
681679
event = Event.for_resource(inspection).last
682680
expect(event.action).to eq("updated")
@@ -712,14 +710,14 @@ def mock_failing_update(error_messages = ["Update error"])
712710
end
713711

714712
context "in production environment" do
715-
before do
713+
before do
716714
allow(Rails.env).to receive(:local?).and_return(false)
717715
allow(Rails.logger).to receive(:error)
718716
end
719717

720718
it "logs error but continues" do
721719
get "/inspections/#{invalid_complete_inspection.id}"
722-
720+
723721
expect(Rails.logger).to have_received(:error).with(/DATA INTEGRITY ERROR/)
724722
expect(response).to have_http_status(:success)
725723
end
@@ -744,7 +742,7 @@ def mock_failing_update(error_messages = ["Update error"])
744742
get "/inspections/#{inspection.id}.json"
745743
expect(response).to have_http_status(:success)
746744
expect(response.content_type).to include("application/json")
747-
745+
748746
json = JSON.parse(response.body)
749747
expect(json).to be_present
750748
expect(json).to have_key("complete")

spec/requests/sessions_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def setup_passkey_session
144144
context "with valid passkey authentication" do
145145
it "authenticates user and creates session" do
146146
# Set up session by calling passkey endpoint first
147-
challenge = setup_passkey_session
147+
setup_passkey_session
148148

149149
# Mock WebAuthn credential
150150
mock_webauthn_credential = instance_double(

spec/serializers/base_assessment_blueprint_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def self.column_name_syms
7171

7272
it "uses PublicFieldFiltering::EXCLUDED_FIELDS constant" do
7373
all_excluded_fields = PublicFieldFiltering::EXCLUDED_FIELDS
74-
74+
7575
# Create a class with all excluded fields plus some public ones
7676
comprehensive_class = Class.new do
7777
define_singleton_method(:column_name_syms) do
@@ -84,4 +84,4 @@ def self.column_name_syms
8484
expect(result).to eq(%i[public_field_1 public_field_2])
8585
end
8686
end
87-
end
87+
end

spec/services/rpii_verification_service_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@
429429
id: "12345",
430430
raw_value: "John Smith (RPII, API)"
431431
})
432-
432+
433433
result = described_class.send(:parse_inspector_item, item)
434434

435435
expect(result).to eq({
@@ -455,7 +455,7 @@
455455
id: "unique-id",
456456
raw_value: "Jane Doe (67890) - RPII"
457457
})
458-
458+
459459
result = described_class.send(:parse_inspector_item, item)
460460

461461
expect(result).to eq({

0 commit comments

Comments
 (0)