Class: Dommy::Rails::RSpec::Matchers::HaveMeta

Inherits:
Object
  • Object
show all
Defined in:
lib/dommy/rails/rspec/matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, property:, content:) ⇒ HaveMeta

Returns a new instance of HaveMeta.



249
250
251
252
253
# File 'lib/dommy/rails/rspec/matchers.rb', line 249

def initialize(name:, property:, content:)
  @name = name
  @property = property
  @content = content
end

Instance Method Details

#descriptionObject



263
264
265
# File 'lib/dommy/rails/rspec/matchers.rb', line 263

def description
  "have meta #{criteria_description}"
end

#does_not_match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


259
260
261
# File 'lib/dommy/rails/rspec/matchers.rb', line 259

def does_not_match?(actual)
  !matches?(actual)
end

#failure_messageObject



267
268
269
# File 'lib/dommy/rails/rspec/matchers.rb', line 267

def failure_message
  "expected to find meta #{criteria_description}"
end

#failure_message_when_negatedObject



271
272
273
# File 'lib/dommy/rails/rspec/matchers.rb', line 271

def failure_message_when_negated
  "expected not to find meta #{criteria_description}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


255
256
257
# File 'lib/dommy/rails/rspec/matchers.rb', line 255

def matches?(actual)
  Dommy::Rails::PageInspector.meta_matches?(MatchTarget.document(actual), name: @name, property: @property, content: @content)
end