Class: Mongoid::Matchers::BeStoredInMatcher
- Defined in:
- lib/matchers/document/be_stored_in.rb
Instance Attribute Summary collapse
-
#collection_name ⇒ Object
readonly
Returns the value of attribute collection_name.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(collection_name) ⇒ BeStoredInMatcher
constructor
A new instance of BeStoredInMatcher.
- #matches?(subject) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(collection_name) ⇒ BeStoredInMatcher
Returns a new instance of BeStoredInMatcher.
12 13 14 |
# File 'lib/matchers/document/be_stored_in.rb', line 12 def initialize collection_name @collection_name = collection_name.to_s end |
Instance Attribute Details
#collection_name ⇒ Object (readonly)
Returns the value of attribute collection_name.
10 11 12 |
# File 'lib/matchers/document/be_stored_in.rb', line 10 def collection_name @collection_name end |
Instance Method Details
#description ⇒ Object
28 29 30 |
# File 'lib/matchers/document/be_stored_in.rb', line 28 def description "be stored in #{collection_name.inspect}" end |
#failure_message ⇒ Object
20 21 22 |
# File 'lib/matchers/document/be_stored_in.rb', line 20 def "Expected #{inspect} to #{description}" end |
#matches?(subject) ⇒ Boolean
16 17 18 |
# File 'lib/matchers/document/be_stored_in.rb', line 16 def matches? subject class_of(subject).collection_name.to_s == collection_name end |
#negative_failure_message ⇒ Object
24 25 26 |
# File 'lib/matchers/document/be_stored_in.rb', line 24 def "Expected not to #{description}" end |