Sha256: a547585c2dbca152e8017cbad9b7dbf030d4cc525f9e9f4d0ae86c77efbebbf7

Contents?: true

Size: 602 Bytes

Versions: 5

Compression:

Stored size: 602 Bytes

Contents

module Mongoid
  module Matchers
    def be_dynamic_document
      BeDynamicDocument.new
    end

    class BeDynamicDocument
      def matches?(actual)
        @model = actual.is_a?(Class) ? actual : actual.class
        @model.included_modules.include?(Mongoid::Attributes::Dynamic)
      end

      def description
        'include Mongoid::Attributes::Dynamic'
      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_dynamic_document.rb
mongoid-rspec-4.1.0 lib/matchers/be_dynamic_document.rb
mongoid-rspec-4.0.1 lib/matchers/be_dynamic_document.rb
mongoid-rspec-4.0.0 lib/matchers/be_dynamic_document.rb
mongoid-spec-4.0.1 lib/matchers/be_dynamic_document.rb