Skip to content

Commit

Permalink
Fix broken semver regex in test.
Browse files Browse the repository at this point in the history
The old regex erroneously rejected version numbers greater than 9.

Fix inspired by https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
  • Loading branch information
sengi committed Oct 21, 2022
1 parent 0b24106 commit 12c8ccc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/lib/govuk_error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

it "sends the version along with the request" do
GovukError.notify(StandardError.new, parameters: "Something")
expect(Sentry).to have_received(:capture_exception).with(StandardError.new, hash_including(tags: { govuk_app_config_version: /^[0-9]\.[0-9]\.[0-9](?:\.pre\.[0-9]+)?$/ }))
expect(Sentry).to have_received(:capture_exception).with(StandardError.new, hash_including(tags: { govuk_app_config_version: /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(\.pre\.[0-9]+)?$/ }))
end
end

Expand Down

0 comments on commit 12c8ccc

Please sign in to comment.