Class: Dommy::Rails::RSpec::Matchers::HaveAuthenticityToken

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



317
318
319
# File 'lib/dommy/rails/rspec/matchers.rb', line 317

def description
  "have Rails authenticity token field"
end

#does_not_match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


313
314
315
# File 'lib/dommy/rails/rspec/matchers.rb', line 313

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

#failure_messageObject



321
322
323
# File 'lib/dommy/rails/rspec/matchers.rb', line 321

def failure_message
  "expected to find Rails authenticity token field"
end

#failure_message_when_negatedObject



325
326
327
# File 'lib/dommy/rails/rspec/matchers.rb', line 325

def failure_message_when_negated
  "expected not to find Rails authenticity token field"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


309
310
311
# File 'lib/dommy/rails/rspec/matchers.rb', line 309

def matches?(actual)
  Dommy::Rails::PageInspector.authenticity_token?(MatchTarget.document(actual))
end