Method: Remarkable::Mongoid::Matchers#have_field

Defined in:
lib/remarkable/mongoid/fields.rb

#have_field(field, options = {}) ⇒ Remarkable::Mongoid::Matchers::HasFieldMatcher

Specify the document should have a field

examples:

it { should have_field :name }
it { should have_field :age, :type => Integer, :default => 0 }

Parameters:

  • options (Symbol, Hash) (defaults to: {})

Options Hash (options):

  • :type (Class)

    The data type

  • :default (Object)

    The default value for this field

Returns:



15
16
17
# File 'lib/remarkable/mongoid/fields.rb', line 15

def have_field(field, options = {})
  HasFieldMatcher.new(field, options)
end