Sha256: cf29b1b6c0676ec1c605086d404ad3e8b5d9d61d2d4452cd398d482483e7bc4f
Contents?: true
Size: 970 Bytes
Versions: 2
Compression:
Stored size: 970 Bytes
Contents
module Remarkable module MongoMapper module Matchers class HaveKeyMatcher < Remarkable::MongoMapper::Base arguments :type, :collection => :attributes, :as => :attribute collection_assertions :has_key? # before_assert do # @type = @options[:type] # end protected def has_key? @subject.respond_to?(@attribute) && @subject.class.keys[@attribute] == ::MongoMapper::Plugins::Keys::Key.new(@attribute, @type) end end # Ensures that a key of the database actually exists. # # == Examples # # should_have_key :name, String # # it { should have_key(:name, String) } # it { should have_keys(:name, :phone_number, String) } # def have_key(*args, &block) HaveKeyMatcher.new(args.pop, *args, &block).spec(self) end alias :have_keys :have_key end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
remarkable_mongo_ign-0.1.2 | lib/remarkable/mongo_mapper/matchers/have_key_matcher.rb |
ippy04-remarkable_mongo-0.1.3 | lib/remarkable/mongo_mapper/matchers/have_key_matcher.rb |