fixturama 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +3 -1
- data/fixturama.gemspec +1 -1
- data/lib/fixturama/seed.rb +2 -1
- data/spec/fixturama/seed_fixture/_spec.rb +2 -1
- data/spec/fixturama/seed_fixture/seed.yml +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d125eca2dd9b59fd748fcda2748c0c115ecdb5958af0f3c2b5d398fdcd4d89f5
|
4
|
+
data.tar.gz: b98edf3a52f9df3513ddd92d444b1b75ea00a1caa29f014023a2f84bd17f21e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b33fdbb647c02d07974520a47212ea31187d16b7ac51fc216c9856c115206270518553b2963b735fac7bacc3e17db6a6d4258e67db802d7e50413c8d1b304797
|
7
|
+
data.tar.gz: b5f4722c8df63e599004c33d9afe383ce329124d9233daf1b3958ca283566f4eca24ca43c632073c8a5a7214a679ff9914fd17510303c5aaa41a8b37cc6f35f2
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
7
|
|
8
|
+
## [0.0.4] - [2018-05-22]
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- The `:count` option for a number of objects to seed at once (nepalez)
|
13
|
+
|
14
|
+
```yaml
|
15
|
+
# Seed 3 customers
|
16
|
+
---
|
17
|
+
- type: user
|
18
|
+
count: 3
|
19
|
+
traits:
|
20
|
+
- customer
|
21
|
+
```
|
22
|
+
|
8
23
|
## [0.0.3] - [2018-05-04]
|
9
24
|
|
10
25
|
### Added
|
@@ -52,3 +67,4 @@ This is a first public release with features extracted from production app.
|
|
52
67
|
[0.0.1]: https://github.com/nepalez/fixturama/releases/tag/v0.0.1
|
53
68
|
[0.0.2]: https://github.com/nepalez/fixturama/compare/v0.0.1...v0.0.2
|
54
69
|
[0.0.3]: https://github.com/nepalez/fixturama/compare/v0.0.2...v0.0.3
|
70
|
+
[0.0.4]: https://github.com/nepalez/fixturama/compare/v0.0.3...v0.0.4
|
data/README.md
CHANGED
@@ -79,7 +79,7 @@ The seed (`seed_fixture`) file should be a YAML/JSON with opinionated parameters
|
|
79
79
|
# ./database.yml
|
80
80
|
#
|
81
81
|
# This is the same as
|
82
|
-
# `
|
82
|
+
# `create_list :profile, 1, :active, id: profile_id`
|
83
83
|
---
|
84
84
|
- type: profile
|
85
85
|
traits:
|
@@ -88,6 +88,8 @@ The seed (`seed_fixture`) file should be a YAML/JSON with opinionated parameters
|
|
88
88
|
id: <%= profile_id %>
|
89
89
|
```
|
90
90
|
|
91
|
+
Use the `count: 2` key to create more objects at once.
|
92
|
+
|
91
93
|
Another opinionated format we use for stubs (`stub_fixture`):
|
92
94
|
|
93
95
|
- `class` for stubbed class
|
data/fixturama.gemspec
CHANGED
data/lib/fixturama/seed.rb
CHANGED
@@ -7,8 +7,9 @@ module Fixturama
|
|
7
7
|
type = opts[:type].to_sym
|
8
8
|
traits = Utils.symbolize_array opts[:traits]
|
9
9
|
params = Utils.symbolize_hash opts[:params]
|
10
|
+
count = opts.fetch(:count, 1).to_i
|
10
11
|
|
11
|
-
FactoryBot.
|
12
|
+
FactoryBot.create_list(type, count, *traits, **params) if count.positive?
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
@@ -25,7 +25,8 @@ RSpec.describe "seed_fixture" do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "runs the factory", aggregate_failures: true do
|
28
|
-
expect(FactoryBot).to receive(:
|
28
|
+
expect(FactoryBot).to receive(:create_list).with(:foo, 1, :baz, qux: 42)
|
29
|
+
expect(FactoryBot).to receive(:create_list).with(:foo, 3, :bar, {})
|
29
30
|
|
30
31
|
subject
|
31
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fixturama
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kozin (nepalez)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factory_bot
|