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

Update spec/views/notifications/index.html.erb_spec.rb file #5924

Merged
merged 4 commits into from
Jul 26, 2024

Conversation

guswhitten
Copy link
Contributor

@guswhitten guswhitten commented Jul 17, 2024

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 notifications

How is this tested? (please write tests!) 💖💪

This PR is only tests

Screenshots please :)

Feelings gif (optional)

@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Jul 17, 2024
Copy link
Collaborator

@elasticspoon elasticspoon left a 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.

Comment on lines 45 to 47
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)
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto

Copy link
Collaborator

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?

@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Jul 25, 2024
@compwron compwron merged commit f87524e into rubyforgood:main Jul 26, 2024
16 of 17 checks passed
guswhitten added a commit to guswhitten/casa that referenced this pull request Aug 7, 2024
elasticspoon pushed a commit that referenced this pull request Aug 14, 2024
* PR for fix #5924 that should already have merged

* fix linting issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
3 participants