Skip to content

Deprecate assert_select* in preparation for rename #91

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

Merged
merged 1 commit into from
Feb 16, 2021

Conversation

seanpdoyle
Copy link
Contributor

This change is a companion PR to rails/rails#41291. While it's
possible that rails/rails#41291 may make Capybara assertion
integration possible, there is still a possibility that applications
would continue to use rails-dom-testing (or both!) to make assertions
about HTML.

Capybara also declares an assert_select method and while the method
names collide, "select" in one case means CSS selector while "select"
means <select> elements in the other.

Since the tool itself includes dom in the package name, and includes
assert_dom_equal helpers already, renaming assert_select and its
other variations to methods starting with assert_dom unifies the
interface.

This change is a companion PR to [rails/rails#41291][]. While it's
possible that [rails/rails#41291][] may make Capybara assertion
integration possible, there is still a possibility that applications
would continue to use rails-dom-testing (or both!) to make assertions
about HTML.

Capybara also declares an `assert_select` method and while the method
names collide, "select" in one case means CSS selector while "select"
means `<select>` elements in the other.

Since the tool itself includes `dom` in the package name, and includes
`assert_dom_equal` helpers already, renaming `assert_select` and its
other variations to methods starting with `assert_dom` unifies the
interface.

[rails/rails#41291]: rails/rails#41291
seanpdoyle added a commit to seanpdoyle/rails-dom-testing that referenced this pull request Feb 16, 2021
Follow-up to [rails#91][], to be merged and released after a final minor
point release including the deprecation.

Renames all `assert_select`-prefixed methods to `assert_dom`-prefixed
variations, and removes deprecation.

[rails#91]: rails#91
@@ -178,6 +178,7 @@ def assert_select(*args, &block)
nest_selection(matches, &block) if block_given? && !matches.empty?
end
end
deprecate assert_select: "assert_select will be renamed to assert_dom in an upcoming release"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we think that assert_css_select or assert_dom_select is a more communicative new name than assert_dom?

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think so, no.

@kaspth kaspth merged commit 7566b4f into rails:master Feb 16, 2021
@kaspth
Copy link
Contributor

kaspth commented Feb 16, 2021

Blam!

@kaspth
Copy link
Contributor

kaspth commented Feb 16, 2021

Benefitting from that leftover Active Support deprecation require 😂

seanpdoyle added a commit to seanpdoyle/rails-dom-testing that referenced this pull request Feb 18, 2021
Bridge the gap between [rails#91][] (shipped) and [rails#92][] (open) by declaring
[alias_method][] expressions for each `assert_select` variation, adding
`assert_dom` variations to the interface.

[rails#91]: rails#91
[rails#92]: rails#92
[alias_method]: https://docs.ruby-lang.org/en/3.0.0/Module.html#method-i-alias_method
smartech7 pushed a commit to smartech7/dom-testing-ruby that referenced this pull request Aug 4, 2023
Bridge the gap between [#91][] (shipped) and [#92][] (open) by declaring
[alias_method][] expressions for each `assert_select` variation, adding
`assert_dom` variations to the interface.

[#91]: rails/rails-dom-testing#91
[#92]: rails/rails-dom-testing#92
[alias_method]: https://docs.ruby-lang.org/en/3.0.0/Module.html#method-i-alias_method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants