Class: Mongoid::Matchers::BeStoredIn
- Inherits:
-
Object
- Object
- Mongoid::Matchers::BeStoredIn
- Defined in:
- lib/matchers/be_stored_in.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(expected) ⇒ BeStoredIn
constructor
A new instance of BeStoredIn.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected) ⇒ BeStoredIn
Returns a new instance of BeStoredIn.
8 9 10 |
# File 'lib/matchers/be_stored_in.rb', line 8 def initialize(expected) @expected_options = expected.transform_values { |v| v.to_sym rescue v }.symbolize_keys end |
Instance Method Details
#description ⇒ Object
17 18 19 |
# File 'lib/matchers/be_stored_in.rb', line 17 def description "be stored in #{@expected_options.inspect}" end |
#failure_message ⇒ Object
21 22 23 |
# File 'lib/matchers/be_stored_in.rb', line 21 def "Expected #{@model.inspect} to #{description}, got #{.inspect}" end |
#failure_message_when_negated ⇒ Object
25 26 27 |
# File 'lib/matchers/be_stored_in.rb', line 25 def "Expected #{@model.inspect} not to #{description}, got #{.inspect}" end |
#matches?(actual) ⇒ Boolean
12 13 14 15 |
# File 'lib/matchers/be_stored_in.rb', line 12 def matches?(actual) @model = actual.is_a?(Class) ? actual : actual.class == @expected_options end |