Class: Playwright::Test::Matchers::PlaywrightMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/playwright/test.rb

Instance Method Summary collapse

Constructor Details

#initialize(expectation_method, *args, **kwargs) ⇒ PlaywrightMatcher

Returns a new instance of PlaywrightMatcher.



26
27
28
29
30
# File 'lib/playwright/test.rb', line 26

def initialize(expectation_method, *args, **kwargs)
  @method = expectation_method
  @args = args
  @kwargs = kwargs
end

Instance Method Details

#does_not_match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
43
44
45
46
# File 'lib/playwright/test.rb', line 40

def does_not_match?(actual)
  assertions_for(actual, true).send(@method, *@args, **@kwargs)
  true
rescue AssertionError => e
  @failure_message = e.full_message
  false
end

#failure_messageObject



48
49
50
# File 'lib/playwright/test.rb', line 48

def failure_message
  @failure_message
end

#failure_message_when_negatedObject



52
53
54
# File 'lib/playwright/test.rb', line 52

def failure_message_when_negated
  @failure_message
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
37
38
# File 'lib/playwright/test.rb', line 32

def matches?(actual)
  assertions_for(actual, false).send(@method, *@args, **@kwargs)
  true
rescue AssertionError => e
  @failure_message = e.full_message
  false
end