lib/matchers/document/document.rb in mongoid-minitest-0.1.1 vs lib/matchers/document/document.rb in mongoid-minitest-0.1.2
- old
+ new
@@ -4,19 +4,17 @@
DOCUMENT = Mongoid::Document
PARANOIA = Mongoid::Paranoia
VERSIONING = Mongoid::Versioning
TIMESTAMPS = Mongoid::Timestamps
- class DocumentModuleMatcher
- include Helpers
-
- def initialize(mod)
+ class DocumentMatcher < Matcher
+ def initialize mod
@mod = mod
end
- def matches?(subject)
- class_of(subject).included_modules.include?(@mod)
+ def matches? subject
+ class_of(subject).included_modules.include? @mod
end
def description
msg = case
when @mod == DOCUMENT then ''
@@ -29,22 +27,22 @@
"be a #{msg}Mongoid document"
end
end
def be_document
- DocumentModuleMatcher.new(DOCUMENT)
+ DocumentMatcher.new DOCUMENT
end
def be_paranoid
- DocumentModuleMatcher.new(PARANOIA)
+ DocumentMatcher.new PARANOIA
end
def be_versioned
- DocumentModuleMatcher.new(VERSIONING)
+ DocumentMatcher.new VERSIONING
end
def be_timestamped
- DocumentModuleMatcher.new(TIMESTAMPS)
+ DocumentMatcher.new TIMESTAMPS
end
end
end
end