Class: Mongoid::Matchers::Document::DocumentMatcher
- Defined in:
- lib/matchers/document/document.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(mod) ⇒ DocumentMatcher
constructor
A new instance of DocumentMatcher.
- #matches?(subject) ⇒ Boolean
Methods inherited from Matcher
#failure_message, #negative_failure_message
Methods included from Helpers
Constructor Details
#initialize(mod) ⇒ DocumentMatcher
Returns a new instance of DocumentMatcher.
10 11 12 |
# File 'lib/matchers/document/document.rb', line 10 def initialize mod @mod = mod end |
Instance Method Details
#description ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/matchers/document/document.rb', line 18 def description msg = case when @mod == DOCUMENT then '' when @mod == PARANOIA then 'paranoid ' when @mod == VERSIONING then 'versioned ' when @mod == TIMESTAMPS then 'timestamped ' else raise "Unknow Mongoid module #{@mod}" end "be a #{msg}Mongoid document" end |
#matches?(subject) ⇒ Boolean
14 15 16 |
# File 'lib/matchers/document/document.rb', line 14 def matches? subject class_of(subject).included_modules.include? @mod end |