Class: Mongoid::Matchers::BeDynamicDocument

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



13
14
15
# File 'lib/matchers/be_dynamic_document.rb', line 13

def description
  'include Mongoid::Attributes::Dynamic'
end

#failure_messageObject



17
18
19
# File 'lib/matchers/be_dynamic_document.rb', line 17

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

#failure_message_when_negatedObject



21
22
23
# File 'lib/matchers/be_dynamic_document.rb', line 21

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

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/matchers/be_dynamic_document.rb', line 8

def matches?(actual)
  @model = actual.is_a?(Class) ? actual : actual.class
  @model.included_modules.include?(Mongoid::Attributes::Dynamic)
end