Module: MongoMapperSweatShop::Model::ClassMethods
- Defined in:
- lib/mongomapper-sweatshop/model.rb
Constant Summary collapse
- @@fixtures =
{}
Instance Method Summary collapse
-
#fix(name = :default, &block) ⇒ Proc
(also: #fixture)
Creates a fixture.
-
#gen(name = :default, overrides = {}) ⇒ Class
(also: #generate)
Generates a fixture and saves it to the test db.
-
#make(name = :default, overrides = {}) ⇒ Class
Generates a fixture without saving to the db.
Instance Method Details
#fix(name = :default, &block) ⇒ Proc Also known as: fixture
Creates a fixture
12 13 14 15 16 17 18 |
# File 'lib/mongomapper-sweatshop/model.rb', line 12 def fix name=:default, &block if name.is_a? Proc block, name = name, :default end SweatShop[self, name] = block #@@fixtures[name] = block end |
#gen(name = :default, overrides = {}) ⇒ Class Also known as: generate
Generates a fixture and saves it to the test db
25 26 27 |
# File 'lib/mongomapper-sweatshop/model.rb', line 25 def gen name=:default, overrides={} self.create SweatShop[self, name, overrides] end |
#make(name = :default, overrides = {}) ⇒ Class
Generates a fixture without saving to the db
35 36 37 |
# File 'lib/mongomapper-sweatshop/model.rb', line 35 def make name=:default, overrides={} self.new SweatShop[self, name, overrides] end |