Sha256: e4acb0d8670808d1f223629316da3bd7b77be6c00ac12252b154cf026ba74be2

Contents?: true

Size: 580 Bytes

Versions: 5

Compression:

Stored size: 580 Bytes

Contents

module Mongoid
  module Matchers
    def be_mongoid_document
      BeMongoidDocument.new
    end

    class BeMongoidDocument
      def matches?(actual)
        @model = actual.is_a?(Class) ? actual : actual.class
        @model.included_modules.include?(Mongoid::Document)
      end

      def description
        'include Mongoid::Document'
      end

      def failure_message
        "expect #{@model.inspect} class to #{description}"
      end

      def failure_message_when_negated
        "expect #{@model.inspect} class to not #{description}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
mongoid-rspec-4.2.0 lib/matchers/be_mongoid_document.rb
mongoid-rspec-4.1.0 lib/matchers/be_mongoid_document.rb
mongoid-rspec-4.0.1 lib/matchers/be_mongoid_document.rb
mongoid-rspec-4.0.0 lib/matchers/be_mongoid_document.rb
mongoid-spec-4.0.1 lib/matchers/be_mongoid_document.rb