Change the default generated request spec for hanami new
#19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix
As of 2.1.0, we don't generate a default route anymore.
As a result, in the
test
environment, a GET request to/
is a 404 (Not Found).The default request spec is used to assert that the root path was successfully found (200).
Running for the first time the specs, after generating the app results in a failing test.
👉 While having a failing test is in line with TDD/BDD philosophy as a clear indicator to implement a missing feature, the experience can be unpleasant for newcomers.
The uncertainty of trying a new framework can be a source of anxiety, and seeing a failing test can have negative emotional imprinting.
👉 My take is to generate a test that expects a 404.
It communicates to the user that we decided to generate an app with a missing root route.
Reassuring twice for the user: it's not them, Hanami team knows what they're doing.
Before
Negative imprinting: failing spec.
After
Positive imprinting: passing spec.
Closes #17