Skip to content

Commit 326b05e

Browse files
committed
Merge branch 'main' of github.com:chobble-mirror/esp32-web-form-trigger
2 parents 4d7c663 + 1d718dd commit 326b05e

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

app/controllers/concerns/submission_processing.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ def submission_params
8787
{}
8888
end
8989
end
90-
end
90+
end

spec/migrations/ensure_form_codes_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ def create_form_without_code(attrs = {})
5555
form3.reload
5656
expect(form3.code).to eq(original_code)
5757
end
58-
end
58+
end

spec/models/form_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,47 +53,47 @@
5353
button_text: "Submit",
5454
code: "ABCDEFGHIJKL"
5555
)
56-
56+
5757
form.name = "Updated Form"
5858
form.save!
59-
59+
6060
expect(form.reload.code).to eq("ABCDEFGHIJKL")
6161
end
6262

6363
it "ensures uniqueness of codes" do
64-
existing_form = Form.create!(
64+
Form.create!(
6565
name: "Existing Form",
6666
button_text: "Submit",
6767
code: "ABCDEFGHIJKL"
6868
)
69-
69+
7070
new_form = Form.new(
7171
name: "New Form",
7272
button_text: "Submit",
7373
code: "ABCDEFGHIJKL"
7474
)
75-
75+
7676
expect(new_form).not_to be_valid
7777
expect(new_form.errors[:code]).to include("has already been taken")
7878
end
7979
end
8080

8181
describe ".find_by_code_or_id" do
8282
let!(:form) { Form.create!(name: "Test Form", button_text: "Submit") }
83-
83+
8484
it "finds a form by its code" do
8585
found_form = Form.find_by_code_or_id(form.code)
8686
expect(found_form).to eq(form)
8787
end
88-
88+
8989
it "finds a form by its ID" do
9090
found_form = Form.find_by_code_or_id(form.id)
9191
expect(found_form).to eq(form)
9292
end
93-
93+
9494
it "returns nil when neither code nor ID matches" do
9595
found_form = Form.find_by_code_or_id("NONEXISTENT")
9696
expect(found_form).to be_nil
9797
end
9898
end
99-
end
99+
end

spec/requests/empty_form_submissions_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
RSpec.describe "Empty form submissions", type: :request do
44
let!(:device) { Device.create!(name: "Test Device", location: "Test Location") }
5-
5+
66
describe "form with no enabled fields" do
77
let!(:form) do
88
Form.create!(
@@ -15,18 +15,18 @@
1515
enable_postcode: false
1616
)
1717
end
18-
18+
1919
it "allows submitting a form with no fields" do
2020
expect {
2121
post public_form_path(form.code, device.id)
2222
}.to change(Submission, :count).by(1)
23-
23+
2424
expect(response).to redirect_to(form_thanks_path(form.code, device))
2525
follow_redirect!
2626
expect(response).to have_http_status(:success)
2727
end
2828
end
29-
29+
3030
describe "code with no enabled fields" do
3131
let!(:form) do
3232
Form.create!(
@@ -39,21 +39,21 @@
3939
enable_postcode: false
4040
)
4141
end
42-
42+
4343
let!(:code) { Code.create!(device: device, form: form) }
44-
44+
4545
it "allows submitting a code form with no fields" do
4646
expect {
4747
post public_code_path(code)
4848
}.to change(Submission, :count).by(1)
49-
49+
5050
expect(response).to redirect_to(code_thanks_path(code))
5151
follow_redirect!
5252
expect(response).to have_http_status(:success)
53-
53+
5454
# Verify the code was claimed
5555
code.reload
5656
expect(code.claimed?).to be true
5757
end
5858
end
59-
end
59+
end

spec/requests/public_forms_code_handling_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
it "renders correctly in the forms edit view" do
6565
# Log in as admin to access the forms
66-
admin = login_as_admin
66+
login_as_admin
6767

6868
# Link the form to the device
6969
form.devices << device
@@ -75,4 +75,4 @@
7575
expect(response.body).to include(public_form_path(form.code, device.id))
7676
end
7777
end
78-
end
78+
end

0 commit comments

Comments
 (0)