fabrication issueshttps://gitlab.com/fabrication-gem/fabrication/-/issues2023-09-06T21:12:54Zhttps://gitlab.com/fabrication-gem/fabrication/-/issues/45Feature request: `persist_with` callback2023-09-06T21:12:54ZJohn FirebaughFeature request: `persist_with` callbackIt would be helpful to have an analog of the `initialize_with` callback for persisting an instance.
Some use cases:
* Using `save` rather than `save!`
* Using `save!(validate: false)`
* Persisting a model with a custom persistence metho...It would be helpful to have an analog of the `initialize_with` callback for persisting an instance.
Some use cases:
* Using `save` rather than `save!`
* Using `save!(validate: false)`
* Persisting a model with a custom persistence method (e.g. one that wraps `save!` with additional logic)
* Persisting a model while disabling callbacks following an approach such as [this](https://gist.github.com/dfl/519245)https://gitlab.com/fabrication-gem/fabrication/-/issues/42Sequel fabrication throw a no primary key error2022-11-10T11:26:49ZMickael KurmannSequel fabrication throw a no primary key errorHi, I made a simple rails app with an rspec test that show the error.
https://github.com/elbouillon/fabrication-postgres-sequel.git
If I try to fabricate a sequel-model the as a child and that child as also an other child the creation f...Hi, I made a simple rails app with an rspec test that show the error.
https://github.com/elbouillon/fabrication-postgres-sequel.git
If I try to fabricate a sequel-model the as a child and that child as also an other child the creation fail.https://gitlab.com/fabrication-gem/fabrication/-/issues/39Deprecate make syntax2022-08-02T13:13:00ZPaul ElliottDeprecate make syntaxThis was meant to support people migrating from machinist, which hasn't been maintained since 2013.
Using this pollutes the Object namespace with extra methods and this approach is generally frowned upon. This issue is to introduce a de...This was meant to support people migrating from machinist, which hasn't been maintained since 2013.
Using this pollutes the Object namespace with extra methods and this approach is generally frowned upon. This issue is to introduce a deprecation warning for this feature with an intent to remove it in fabrication 3.Paul ElliottPaul Elliotthttps://gitlab.com/fabrication-gem/fabrication/-/issues/37Investigate an emitter pattern2022-06-23T16:04:29ZPaul ElliottInvestigate an emitter patternRight now there are a series of methods in `Fabrication::Schematic::Definition` that perform the build/create/to_params/etc generation. I think we could make this a lot cleaner by passing the definition into a separate emitter object tha...Right now there are a series of methods in `Fabrication::Schematic::Definition` that perform the build/create/to_params/etc generation. I think we could make this a lot cleaner by passing the definition into a separate emitter object that does the right thing _and only that one thing_.Paul ElliottPaul Elliotthttps://gitlab.com/fabrication-gem/fabrication/-/issues/34Implement rubocop hooks2022-05-25T14:56:21ZPaul ElliottImplement rubocop hooksWe should make a rubocop-fabrication gem that helps users avoid common pitfalls in using the library. This can also assist with conversion of deprecated features.We should make a rubocop-fabrication gem that helps users avoid common pitfalls in using the library. This can also assist with conversion of deprecated features.Paul ElliottPaul Elliotthttps://gitlab.com/fabrication-gem/fabrication/-/issues/28Schematic mixins2022-04-12T15:33:44ZPaul ElliottSchematic mixinsThis feature would introduce a new primitive, the `Fabricator.mixin`. It would allow you to declare a fieldset that is not associated with any given class. You could then use that in inheritence lists in other fabricators.
Declaration w...This feature would introduce a new primitive, the `Fabricator.mixin`. It would allow you to declare a fieldset that is not associated with any given class. You could then use that in inheritence lists in other fabricators.
Declaration would look like this and support all the things you could do in a normal fabricator schematic.
```
Fabricator.mixin(:name_fields) do
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
full_name { |attrs| [attrs[:first_name], attrs[:last_name]].join(' ') }
end
```
You could then leverage these in any other fabricator regardless of the emitted object.
```
Fabricator(:user, mixins: :name_fields) do
# more fields specific to the User model
end
Fabricate(:customer, mixins: :name_fields) do
# also could work when generating
end
```
This could also just leverage the `from` attribute. The benefit of that is it would allow you to apply mixins anywhere along the dependency chain. If done as a separate field they would apply after the `from` attribute is applied.Paul ElliottPaul Elliotthttps://gitlab.com/fabrication-gem/fabrication/-/issues/27Multiple inheritance2022-04-12T15:25:38ZPaul ElliottMultiple inheritanceThis change would allow you to specify multiple fabricators to inherit from instead of just one. This would allow you to compose a new fabricator from a non-linear set of upstream fabricators. It would look like this in a definition.
``...This change would allow you to specify multiple fabricators to inherit from instead of just one. This would allow you to compose a new fabricator from a non-linear set of upstream fabricators. It would look like this in a definition.
```
Fabricator(:parent1) do
number_field 1
extra_field 'should appear'
end
Fabricator(:parent2) do
number_field 2
string_field 'two'
end
Fabricator(:example, from: %i[parent1, parent2]) do
another_field 'also should appear'
end
```
The generator would apply the declared schematics in order when generating, producing the following output from the above example.
```
Fabricate(:example)
#<Example:0x0000000000000000
number_field: 2,
extra_field: 'should appear',
string_field: 'two',
another_field: 'also should appear'>
```Paul ElliottPaul Elliotthttps://gitlab.com/fabrication-gem/fabrication/-/issues/17[Feature Request] Add FactoryBot like sequence object.2021-08-22T06:01:55ZBillyvil963@gmail.com[Feature Request] Add FactoryBot like sequence object.Following is a example
```rb
Fabricator(:firm) do
name { sequence(:name) { |i| "whatever #{i}" } }
end
Fabricator(:stock) do
name { sequence(:name) { |i| "whatever #{i}" } }
exchange
end
Fabricator(:exchange) do
name { sequenc...Following is a example
```rb
Fabricator(:firm) do
name { sequence(:name) { |i| "whatever #{i}" } }
end
Fabricator(:stock) do
name { sequence(:name) { |i| "whatever #{i}" } }
exchange
end
Fabricator(:exchange) do
name { sequence(:name) { |i| "whatever #{i}" } }
end
```
I have three fabrication, both exist name column, which must be exist, and unique.
is there exist a similar usage, to extract name sequence out, e.g. like factorybot
```rb
sequence(:name) { |i| "whatever #{n}" }
Fabricator(:firm) do
name
end
Fabricator(:stock) do
name
exchange
end
Fabricator(:exchange) do
name
end
```
Thank you.Paul ElliottPaul Elliotthttps://gitlab.com/fabrication-gem/fabrication/-/issues/12Extract cucumber support to a separate gem2021-04-18T00:32:31ZPaul ElliottExtract cucumber support to a separate gemWe'll make a `fabrication-cucumber` gem that extends with that functionality.We'll make a `fabrication-cucumber` gem that extends with that functionality.Paul ElliottPaul Elliotthttps://gitlab.com/fabrication-gem/fabrication/-/issues/7Fabrication 3.02022-07-25T19:57:54ZPaul ElliottFabrication 3.0### These are my initial thoughts on the rewrite and release plan. Everything here is subject to change. If you have thoughts please comment!
This will be a significant rewrite of the gem but will maintain the same functionality. In add...### These are my initial thoughts on the rewrite and release plan. Everything here is subject to change. If you have thoughts please comment!
This will be a significant rewrite of the gem but will maintain the same functionality. In addition to major refactorings of the internals of fabrication we will be splitting the gem out into an array of gems providing support for specific frameworks and ORMs.
- [x] DataMapper support removed in `fabrication-3.0.0.beta.1`
- [x] ~~`fabrication-rom` will be created (#11)~~
- [ ] `fabrication-cucumber` will be extracted in `fabrication-3.0.0.beta.2` (#12)
- [x] ~~`fabrication-sequel` will be extracted in `fabrication-3.0.0.beta.3` (#13)~~
- [x] ~~`fabrication-mongoid` will be extracted in `fabrication-3.0.0.beta.4` (#14)~~
- [ ] Refactorings of the core library will happen in `fabrication-3.0.0.beta.4` and beyond.
The reason for these extractions is so we can have explicit gem dependencies on those libraries while keeping the base gem dependency-free.Paul ElliottPaul Elliott