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

Missing assertions #5002

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Missing assertions #5002

wants to merge 6 commits into from

Conversation

simi
Copy link
Member

@simi simi commented Sep 1, 2024

One step closer to warning-less Rails 7.2. I was pretty skeptic to this new feature first, but it helped to reveal few broken places doing no assertions and testing nothing. Also it reveals quite strange mix of some test responsibilities like functional tests testing template outputs using Capybara (that's what system/integration test should do IMHO) and vice versa. I did the smallest change for now to eliminate all warnings.

Copy link

codecov bot commented Sep 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.02%. Comparing base (93e5e10) to head (155df7e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5002   +/-   ##
=======================================
  Coverage   97.02%   97.02%           
=======================================
  Files         420      420           
  Lines        8726     8726           
=======================================
  Hits         8466     8466           
  Misses        260      260           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@simi simi marked this pull request as ready for review September 1, 2024 18:45
@@ -223,7 +223,7 @@ class ApiKeysControllerTest < ActionController::TestCase
end

should "show error to user" do
page.assert_text "Show dashboard scope must be enabled exclusively"
assert page.has_content? "Show dashboard scope must be enabled exclusively"
Copy link
Member

Choose a reason for hiding this comment

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

these changes actively make assertion failure worse, can we migrate at least to the capybara minitest methods to maintain the good error messages?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's the case I have explained in the description. It is not possible to simply including capybara assertions since they do conflict with rails-dom-testing gem. For example assert_select does different kind of assertion. Happy to move those tests to be integration ones in next PR and remove rails-dom-testing dependency (maybe rails-controller-testing in general) at all.

Copy link
Member Author

@simi simi Sep 2, 2024

Choose a reason for hiding this comment

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

Alternatively I can manually port assert_content assertion to functional tests to cover most of the similar changes to report with nice and friendly message before mentioned refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants