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.



39
40
41
42
43
# File 'lib/playwright/test.rb', line 39

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

Instance Method Details

#does_not_match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
56
57
58
59
# File 'lib/playwright/test.rb', line 53

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

#failure_messageObject



61
62
63
# File 'lib/playwright/test.rb', line 61

def failure_message
  @failure_message
end

#failure_message_when_negatedObject



65
66
67
# File 'lib/playwright/test.rb', line 65

def failure_message_when_negated
  @failure_message
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
48
49
50
51
# File 'lib/playwright/test.rb', line 45

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