Module: Dommy::RSpec
- Defined in:
- lib/dommy/rspec/matchers.rb,
lib/dommy/rspec/capy_style_matchers.rb
Defined Under Namespace
Modules: CapyStyleMatchers, Matchers
Class Attribute Summary collapse
-
.failure_context ⇒ Object
A
->(subject) { String | nil }consulted when a matcher fails: its return value is appended to the failure message.
Class Method Summary collapse
-
.__decorate_failure(message, subject) ⇒ Object
Append the host's failure context to
messageforsubject, or returnmessageunchanged.
Class Attribute Details
.failure_context ⇒ Object
A ->(subject) { String | nil } consulted when a matcher fails: its
return value is appended to the failure message. Hosts set this to add
context (dommy-rails registers a recent-trace summary for trace-enabled
sessions). nil (the default) leaves every message untouched.
467 468 469 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 467 def failure_context @failure_context end |
Class Method Details
.__decorate_failure(message, subject) ⇒ Object
Append the host's failure context to message for subject, or return
message unchanged. Never raises out of a failure path: a misbehaving
context proc must not mask the real assertion failure.
473 474 475 476 477 478 479 480 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 473 def self.__decorate_failure(, subject) return unless failure_context && subject extra = failure_context.call(subject) extra ? "#{}\n\n#{extra}" : rescue StandardError end |