Class: NoBrainer::Matchers::HaveTimestamps

Inherits:
Object
  • Object
show all
Defined in:
lib/matchers/have_timestamps.rb

Instance Method Summary collapse

Constructor Details

#initializeHaveTimestamps



10
11
12
# File 'lib/matchers/have_timestamps.rb', line 10

def initialize
  @root_module = 'NoBrainer::Document::Timestamps'
end

Instance Method Details

#descriptionObject



19
20
21
# File 'lib/matchers/have_timestamps.rb', line 19

def description
  'be a NoBrainer document with timestamps'
end

#failure_messageObject



23
24
25
# File 'lib/matchers/have_timestamps.rb', line 23

def failure_message
  "Expected #{@model.inspect} class to #{description}"
end

#failure_message_when_negatedObject



27
28
29
# File 'lib/matchers/have_timestamps.rb', line 27

def failure_message_when_negated
  "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