-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add attributes
as a name to the v4 blacklist for DSL definitions
#81
Comments
This is an intractable problem and solved by your load order being incorrect. the RSpec defined matchers allow us to use our metaprogrammed matchers inside RSpecs metaprogrammed assertion logic. I would look at your stack and see if you can isolate your logic. Or failing that control your load order more succinctly. You are encountering the same issue as anyone else would when overwriting any protected method name |
@luke-hill First, thanks for coming back on this and taking the time to look into this! :) However, I don't think this is a loading issue. SitePrism can override the default RSpec matcher for I'm not sure why SitePrism defines its own matchers at all since I would expect the Maybe I'm just missing a piece here on why these are necessary... Do you know why that would be? |
I'm not going to lie, that area has changed a lot recently. So if you're having problems, I need you to perhaps dig a bit deeper into it as I don't have time at the moment. If memory serves me right, this was to allow us to do complex matching. and also to add a negative matcher (Which is needed to be custom, as it deviates from RSpecs default ! behaviour). It seems as though what you're proposing is to remove the positive matcher. Now if this has no adverse effects, and you can reconcile the unit tests / feature tests (I'm aware we have 2 failing ones on old firefox). Then I'm not against some changes being made. I hope that helps. I'll leave this open for some discussion if needed. |
Are you speaking of the |
Any thoughts on this @kouno At the moment I'm spending a lot of time tackling some internal tech debt around capybara restrictions. Once that is finished I need to cut a stable v1 of the all_there gem. So that's gonna keep me tied up for a while. |
@luke-hill I don't think there is much urgency to fix this bug yet so feel free to leave on the side for now. I'll make a PR when I'm ready and have gotten cucumber tests running locally. |
So re-reading this now we have 2 avenues.
I do plan on committing a bit more time to work on this where time allows. I'm also pushing a bit on the funding route now, as I've seen how it can help from other avenues. |
have_attributes
gets ovewrittenhave_attributes
matcher can be overwritten by section matcher section, :attributes, '.locator'
@kouno Having spent some time off recently, I've come back to this. I think the best thing is add this to the blacklist. Which whilst masking the issue I think is probably the best one. As it'll also allow us to be stricter with other names we don't want in the blacklist (Such as special characters e.t.c.) |
have_attributes
matcher can be overwritten by section matcher section, :attributes, '.locator'
attributes
as a name to the v4 blacklist for DSL definitions
Released in v4.0.beta - Initially disabled as a configurable option cc/ @kouno |
Environment
Issue
When defining a new class inheriting from SitePrism::Page which defines a
:attributes
section, the default helperhave_attributes
from RSpec gets overwritten.Steps to reproduce
Here is a RSpec test to showcase the issue:
The matcher for have_attributes should be: https://relishapp.com/rspec/rspec-expectations/v/3-9/docs/built-in-matchers/have-attributes-matcher.
From what I saw in the docs and in the code,
SitePrism::RSpecMatchers
seems to define newhave_*
matchers. Is this still necessary since RSpec already have thehave_xxx
matcher?The text was updated successfully, but these errors were encountered: