Class: Playwright::Test::Matchers::PlaywrightMatcher
- Inherits:
-
Object
- Object
- Playwright::Test::Matchers::PlaywrightMatcher
- Defined in:
- lib/playwright/test.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#failure_message_when_negated ⇒ Object
we have to invert the message again here because RSpec wants to control its own negation.
-
#initialize(expectation_method, *args, **kwargs) ⇒ PlaywrightMatcher
constructor
A new instance of PlaywrightMatcher.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expectation_method, *args, **kwargs) ⇒ PlaywrightMatcher
Returns a new instance of PlaywrightMatcher.
29 30 31 32 33 |
# File 'lib/playwright/test.rb', line 29 def initialize(expectation_method, *args, **kwargs) @method = expectation_method @args = args @kwargs = kwargs end |
Instance Method Details
#failure_message ⇒ Object
43 44 45 |
# File 'lib/playwright/test.rb', line 43 def @failure_message end |
#failure_message_when_negated ⇒ Object
we have to invert the message again here because RSpec wants to control its own negation
49 50 51 |
# File 'lib/playwright/test.rb', line 49 def @failure_message.gsub("expected to", "not expected to") end |
#matches?(actual) ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'lib/playwright/test.rb', line 35 def matches?(actual) Expect.new.call(actual).send(@method, *@args, **@kwargs) true rescue AssertionError => e @failure_message = e. false end |