class NoBrainer::Matchers::HaveTimestamps

Public Class Methods

new() click to toggle source
# File lib/matchers/have_timestamps.rb, line 10
def initialize
  @root_module = 'NoBrainer::Document::Timestamps'
end

Public Instance Methods

description() click to toggle source
# File lib/matchers/have_timestamps.rb, line 19
def description
  'be a NoBrainer document with timestamps'
end
failure_message() click to toggle source
# File lib/matchers/have_timestamps.rb, line 23
def failure_message
  "Expected #{@model.inspect} class to #{description}"
end
failure_message_when_negated() click to toggle source
# File lib/matchers/have_timestamps.rb, line 27
def failure_message_when_negated
  "Expected #{@model.inspect} class to not #{description}"
end
matches?(actual) click to toggle source
# 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

Private Instance Methods

expected_module() click to toggle source
# File lib/matchers/have_timestamps.rb, line 33
def expected_module
  @root_module.constantize
end