Class: NoBrainer::Matchers::BeNoBrainerDocument

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



15
16
17
# File 'lib/matchers/be_nobrainer_document.rb', line 15

def description
  'include NoBrainer::Document'
end

#failure_messageObject



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

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

#failure_message_when_negatedObject



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

def failure_message_when_negated
  "expect #{@model.inspect} class to not #{description}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


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

def matches?(actual)
  @model = actual.is_a?(Class) ? actual : actual.class
  @model.included_modules.include?(NoBrainer::Document)
end