Class: Mongoid::Matchers::BeStoredInMatcher

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/matchers/document/be_stored_in.rb

Instance Method Summary collapse

Methods included from Helpers

#class_of, #to_sentence

Constructor Details

#initialize(collection_name) ⇒ BeStoredInMatcher

Returns a new instance of BeStoredInMatcher.



6
7
8
# File 'lib/matchers/document/be_stored_in.rb', line 6

def initialize(collection_name)
  @collection_name = collection_name.to_s
end

Instance Method Details

#descriptionObject



14
15
16
# File 'lib/matchers/document/be_stored_in.rb', line 14

def description
  "be stored in #{@collection_name.inspect}"
end

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/matchers/document/be_stored_in.rb', line 10

def matches?(subject)
  class_of(subject).collection_name.to_s == @collection_name
end