Sha256: 037ba8e2a8d611813a23d43954e52c6d6fd70ae7f34bd9def7b877822a58c5f6

Contents?: true

Size: 499 Bytes

Versions: 33

Compression:

Stored size: 499 Bytes

Contents

module MongoTest
  class ThingBase
    def self.collection
      @connection ||= ::Mongo::Connection.new('127.0.0.1')
      @db ||= @connection.db('database_cleaner_specs')
      @mongo ||= @db.collection(name) || @db.create_collection(name)
    end

    def self.count
      @mongo.count
    end

    def initialize(attrs={})
      @attrs = attrs
    end

    def save!
      self.class.collection.insert(@attrs)
    end
  end

  class Widget < ThingBase
  end
  class Gadget < ThingBase
  end
end

Version data entries

33 entries across 28 versions & 5 rubygems

Version Path
database_cleaner-1.6.2 spec/database_cleaner/mongo/mongo_examples.rb
database_cleaner-1.6.1 spec/database_cleaner/mongo/mongo_examples.rb
database_cleaner-1.6.0 spec/database_cleaner/mongo/mongo_examples.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/mongo/mongo_examples.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/mongo/mongo_examples.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/mongo/mongo_examples.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/mongo/mongo_examples.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/mongo/mongo_examples.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/mongo/mongo_examples.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/mongo/mongo_examples.rb
database_cleaner-1.5.3 spec/database_cleaner/mongo/mongo_examples.rb
database_cleaner-1.5.2 spec/database_cleaner/mongo/mongo_examples.rb
database_cleaner-1.5.1 spec/database_cleaner/mongo/mongo_examples.rb
database_cleaner-1.5.0 spec/database_cleaner/mongo/mongo_examples.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/database_cleaner-1.4.1/spec/database_cleaner/mongo/mongo_examples.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/database_cleaner-1.4.1/spec/database_cleaner/mongo/mongo_examples.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/database_cleaner-1.4.1/spec/database_cleaner/mongo/mongo_examples.rb
database_cleaner-1.4.1 spec/database_cleaner/mongo/mongo_examples.rb
database_cleaner-1.4.0 spec/database_cleaner/mongo/mongo_examples.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/database_cleaner-1.2.0/spec/database_cleaner/mongo/mongo_examples.rb