Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed Name blank flash #1805

Merged
merged 9 commits into from
Jan 13, 2024
Merged

Proposed Name blank flash #1805

merged 9 commits into from
Jan 13, 2024

Conversation

JoeCohen
Copy link
Member

  • Displays a correct flash error if a User enters a blank Proposed Name:
    Instead of
    "There is a problem with the name. See message below." (with no message below)
    displays
    "Scientific Name missing"
  • Fixes Missing message if a Proposed Name is blank. #1796

I'm changing my approach to solving the underlying problem.
Instead of adding a message below:
Add a flash error that's complete without additional explanation.

Adding a message below is too convoluted for me to figure out.
If the User left the Scientific Name blank, flash a simple error message.
- Changes their order
- Removes redundant assertion
- Removes outdated comment
- inline cop disable/enable
- extract method
- guard clause instead of conditional
- `present?` instead of regexp
- For Create Observation, include "Leave this field blank if you don't know the scientific name"
- else, omit that text
Fixes
```ruby
NameError: undefined local variable or method `form_naming_what_missing' for #<NamingsIntegrationTest:0x00007f2c89cda1d8>
            test/integration/capybara/namings_integration_test.rb:51:in `test_proposing_names'
```
@JoeCohen JoeCohen linked an issue Jan 13, 2024 that may be closed by this pull request
7 tasks
@JoeCohen JoeCohen marked this pull request as ready for review January 13, 2024 08:37
@JoeCohen JoeCohen requested a review from nimmolo January 13, 2024 08:40
- Allows string to change without breaking test
- Makes test expectation less magical
@coveralls
Copy link
Collaborator

Coverage Status

coverage: 94.602% (+0.001%) from 94.601%
when pulling 7e59e4d on 1796-proposed-name-blank-message
into d239896 on main.

form_observations_there_is_a_problem_with_location: There is a problem with the location. "+See message below.+":#location_messages
form_observations_there_is_a_problem_with_name: There is a problem with the name. "+See message below.+":#name_messages
form_observations_there_is_a_problem_with_location: There is a problem with the location. "+[:SEE_MESSAGE_BELOW]+":#location_messages
form_observations_there_is_a_problem_with_name: There is a problem with the name. "+[:SEE_MESSAGE_BELOW]+":#name_messages

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the reuse here

@nimmolo nimmolo merged commit 599ef0d into main Jan 13, 2024
4 of 5 checks passed
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.

Missing message if a Proposed Name is blank.
3 participants