Skip to content

Commit 6c74ed6

Browse files
Fix StandardRB linting issues
- Auto-corrected Ruby style issues - Applied standardrb --fix [Automated daily update]
1 parent 6eaba08 commit 6c74ed6

File tree

11 files changed

+107
-76
lines changed

11 files changed

+107
-76
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/assessments/slide_assessment_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@
329329
.once
330330
expect(EN14960::Calculators::SlideCalculator).not_to receive(:meets_height_requirements?)
331331
.with(3.0, 1.2, 0.5, false)
332-
332+
333333
slide_assessment.meets_wall_height_requirements?
334334
end
335335
end
@@ -406,4 +406,4 @@
406406
expect(described_class.primary_key).to eq("inspection_id")
407407
end
408408
end
409-
end
409+
end

spec/models/inspection_spec.rb

Lines changed: 13 additions & 13 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
@@ -427,19 +427,19 @@
427427
describe "#each_applicable_assessment" do
428428
it "yields each applicable assessment with key, class, and instance" do
429429
yielded_assessments = []
430-
430+
431431
inspection.each_applicable_assessment do |key, klass, assessment|
432432
yielded_assessments << [key, klass, assessment]
433433
end
434-
434+
435435
# Should yield all applicable assessments for a castle
436436
expect(yielded_assessments.map(&:first)).to include(
437437
:user_height_assessment,
438438
:structure_assessment,
439439
:materials_assessment,
440440
:fan_assessment
441441
)
442-
442+
443443
# Each yielded assessment should have the correct class
444444
yielded_assessments.each do |key, klass, assessment|
445445
expect(assessment).to be_a(klass)
@@ -449,20 +449,20 @@
449449
it "only yields slide assessment when has_slide is true" do
450450
inspection.has_slide = false
451451
yielded_keys = []
452-
452+
453453
inspection.each_applicable_assessment do |key, _, _|
454454
yielded_keys << key
455455
end
456-
456+
457457
expect(yielded_keys).not_to include(:slide_assessment)
458-
458+
459459
inspection.has_slide = true
460460
yielded_keys = []
461-
461+
462462
inspection.each_applicable_assessment do |key, _, _|
463463
yielded_keys << key
464464
end
465-
465+
466466
expect(yielded_keys).to include(:slide_assessment)
467467
end
468468

@@ -487,14 +487,14 @@
487487
it "includes incomplete field information for each tab" do
488488
inspection.user_height_assessment.update(containing_wall_height: nil)
489489
errors = inspection.completion_errors
490-
490+
491491
expect(errors.any? { |e| e.include?(I18n.t("forms.user_height.header")) }).to be true
492492
end
493493

494494
it "formats errors with tab name and field labels" do
495495
inspection.passed = nil
496496
errors = inspection.completion_errors
497-
497+
498498
expect(errors.any? { |e| e.include?(I18n.t("forms.results.header")) }).to be true
499499
end
500500
end
@@ -507,7 +507,7 @@
507507
resource: inspection,
508508
details: "Test details"
509509
)
510-
510+
511511
inspection.log_audit_action("test_action", user, "Test details")
512512
end
513513
end

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

0 commit comments

Comments
 (0)