Skip to content

Make error messages consistent#19

Merged
jcouball merged 1 commit into
mainfrom
error_messages
Jul 1, 2025
Merged

Make error messages consistent#19
jcouball merged 1 commit into
mainfrom
error_messages

Conversation

@jcouball

@jcouball jcouball commented Jul 1, 2025

Copy link
Copy Markdown
Member

Change 1:

Error messages should consistently use the "expected ... but it ..." format.

Reviewed all error messages in the project.

Change 2:

Changed all tests that have error message expectations from:

expect { subject }.to raise_error(ArgumentError, expected_message)

to:

expect { subject }.to raise_error(ArgumentError) do |error|
  expect(error.message).to match(expected_message)
end

so that error messages are diff'd when they don't match.

Change 1:

Error messages should consistently use the "expected ... but it ..." format.

Reviewed all error messages in the project.

Change 2:
Changed all tests that have error message expectations from:

```
expect { subject }.to raise_error(ArgumentError, expected_message)
```

to:

```
expect { subject }.to raise_error(ArgumentError) do |error|
  expect(error.message).to match(expected_message)
end
```

so that error messages are diff'd when they don't match.
@jcouball
jcouball merged commit 3a5f730 into main Jul 1, 2025
3 checks passed
@jcouball
jcouball deleted the error_messages branch July 1, 2025 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant