Class: NoBrainer::Matchers::HaveTimestamps
- Inherits:
-
Object
- Object
- NoBrainer::Matchers::HaveTimestamps
- Defined in:
- lib/matchers/have_timestamps.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize ⇒ HaveTimestamps
constructor
A new instance of HaveTimestamps.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize ⇒ HaveTimestamps
10 11 12 |
# File 'lib/matchers/have_timestamps.rb', line 10 def initialize @root_module = 'NoBrainer::Document::Timestamps' end |
Instance Method Details
#description ⇒ Object
19 20 21 |
# File 'lib/matchers/have_timestamps.rb', line 19 def description 'be a NoBrainer document with timestamps' end |
#failure_message ⇒ Object
23 24 25 |
# File 'lib/matchers/have_timestamps.rb', line 23 def "Expected #{@model.inspect} class to #{description}" end |
#failure_message_when_negated ⇒ Object
27 28 29 |
# File 'lib/matchers/have_timestamps.rb', line 27 def "Expected #{@model.inspect} class to not #{description}" end |
#matches?(actual) ⇒ Boolean
14 15 16 17 |
# File 'lib/matchers/have_timestamps.rb', line 14 def matches?(actual) @model = actual.is_a?(Class) ? actual : actual.class @model.included_modules.include?(expected_module) end |