-
-
Notifications
You must be signed in to change notification settings - Fork 486
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
Update spec/views/notifications/index.html.erb_spec.rb file #5924
Conversation
…tifications factorybots
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! The tests are largely good but if you don't mind could you change the RSpec expectations to use hard coded values instead of values from the factories.
It makes the tests easier to read and instills more confidence in the tests. See my comments for specifics.
expect(notifications_html[0].text).to include(notification_1_hour_ago.event.message) | ||
expect(notifications_html[1].text).to include(notification_1_day_ago.event.message) | ||
expect(notifications_html[2].text).to include(notification_2_days_ago.event.message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we hard code these? expect(notifications_html[0].text).to include("Message 0")
patch_note_index = notifications_html.index { |node| node.text.include?("Patch Notes") } | ||
|
||
expect(patch_note_index).to eq(3) | ||
expect(notifications_html[patch_note_index + 1].text).to include(notification_3_days_ago.event.message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few other places in this code where it does something like: expect(page).to include(patch_note_a.note)
could you also change those to use hard coded values?
What github issue is this PR for, if any?
Resolves #5685
Resolves #5686
Resolves #5687
What changed, and why?
Update and add tests to file
spec/views/notifications/index.html.erb_spec.rb
using new FactoryBot notificationsHow is this tested? (please write tests!) 💖💪
This PR is only tests
Screenshots please :)
Feelings gif (optional)