FluentFixtures::
DSL module
Attributes
- base_fixture RW
The name of the base fixture for the fixture module as a Symbol
- collection RW
The
FluentFixtures::Collection
the fixture is part of- decorator_options R
The Hash of options hashes for declared decorators
- decorators R
The Hash of decorators declared for this fixture module
Public Instance Methods
Declare decorators for the other_fixture
instead of the current one.
Add a callback to the fixture that will be passed new instances after it’s saved. The results of the block will be used as the fixtured instance.
Declare a new_name
for the decorator declared with with original_name
.
Declare a base fixture for the current module called name
, with an optional initial decorator as a block
. If no name
is given, one is chosen based on the name of the declaring module.
Add a callback to the fixture that will be passed new instances after all decorators have been applied and immediately before it’s saved. The results of the block will be used as the fixtured instance.
Declare a decorator that is composed out of other decorators and an optional block
. The first hash
pair should be the name of the declared decorator and the names of the decorator/s it is composed of.
Example:
decorator :foo { ... } decorator :bar { ... } compose( :simple => :foo ) { ... } compose( :complex => [:foo, :bar] ) { ... } compose( :complex_with_args => {foo: [1,2], bar: "Something"} ) { ... }
Declare a decorator for the fixture with the specified name
that will use the given block
.
Returns true
if there is a decorator with the specified name
.
Register one or more other_fixtures
that should be loaded when this fixture is loaded.
Return an instance of Cozy::FluentFixtures::FluentFactory for the base fixture of the receiving module.
Get/set the Class the fixture will use.
Return an unsaved instance of the fixtured class with the specified args
and block
, applying the base decorator if there is one.