fixturama 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f04b46184ce1d6f3dcb64b6d39b16f0d33b1fa4f5c0900328361a43c984f521
4
- data.tar.gz: 52356f415a1ed49571c0448e563d7b60ad6d800728de9763fc66cd3f39b37b89
3
+ metadata.gz: d125eca2dd9b59fd748fcda2748c0c115ecdb5958af0f3c2b5d398fdcd4d89f5
4
+ data.tar.gz: b98edf3a52f9df3513ddd92d444b1b75ea00a1caa29f014023a2f84bd17f21e6
5
5
  SHA512:
6
- metadata.gz: eebbc37fc482726aa1cffef2d9d2f26e309a1bc6ca63c11719ecb5d22629eafd93218803a7bb2575a59d508185f0a18722c766e41ab68be1f8f7f9c3d9706ffe
7
- data.tar.gz: 6c81e6161a0a772a2a947407400ccf51888cb734f191ad7b60187423d550cb5894ef2a110f1bf808fdaf6e4e754f678400a41947e71a6e42c230b09664d56b62
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
- # `create :profile, :active, id: profile_id`
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "fixturama"
3
- gem.version = "0.0.3"
3
+ gem.version = "0.0.4"
4
4
  gem.author = "Andrew Kozin (nepalez)"
5
5
  gem.email = "andrew.kozin@gmail.com"
6
6
  gem.homepage = "https://github.com/nepalez/fixturama"
@@ -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.create(type, *traits, **params)
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(:create).and_return(bar: 99, baz: 77, qux: 42)
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
@@ -1,7 +1,16 @@
1
1
  ---
2
2
  - type: foo
3
3
  traits:
4
- - bar
5
4
  - baz
6
5
  params:
7
6
  qux: 42
7
+
8
+ - type: foo
9
+ count: 3
10
+ traits:
11
+ - bar
12
+
13
+ - type: foo
14
+ count: 0
15
+ traits:
16
+ - baz
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.3
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-04 00:00:00.000000000 Z
11
+ date: 2019-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: factory_bot