lib/matchers/document/be_stored_in.rb in mongoid-minitest-1.0.0 vs lib/matchers/document/be_stored_in.rb in mongoid-minitest-1.1.0
- old
+ new
@@ -1,21 +1,33 @@
module Mongoid
module Matchers
+ def be_stored_in collection_name
+ BeStoredInMatcher.new collection_name
+ end
+
+ private
+
class BeStoredInMatcher < Matcher
+ attr_reader :collection_name
+
def initialize collection_name
@collection_name = collection_name.to_s
end
def matches? subject
- class_of(subject).collection_name.to_s == @collection_name
+ class_of(subject).collection_name.to_s == collection_name
end
- def description
- "be stored in #{@collection_name.inspect}"
+ def failure_message
+ "Expected #{inspect} to #{description}"
end
- end
- def be_stored_in collection_name
- BeStoredInMatcher.new collection_name
+ def negative_failure_message
+ "Expected not to #{description}"
+ end
+
+ def description
+ "be stored in #{collection_name.inspect}"
+ end
end
end
end