factory_bot 1.0.0.alpha → 1.0.1.alpha

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fcff4a8af6eb5f509ff19dd5a333ec6c3de2e8cd
4
- data.tar.gz: e9d8214553953b1c61148eccfa7f7b810e7e045d
3
+ metadata.gz: 0e5696c36ce835a9ff0c7202fa25b7666d437d80
4
+ data.tar.gz: 5bc4ff2a8752c4ac62f7bffdfc74ae9e5c4e1787
5
5
  SHA512:
6
- metadata.gz: 682388106908e80999ded8c4ccce299dd3f2260ecf263ea11c69e48197a6a8f1403c45cabbc5f4fc7fc4712c330538de2c58e554b65bd26effd0ee383937a261
7
- data.tar.gz: 0c6d58ea99fcd57e988f375a750403020717455bdcd6d382e7f13333e82f4eae48d2bf1a99ffcdcef4d61e9f4d66cdac2dbc8af9c90235fc231eb6b0ec1fd1ec
6
+ metadata.gz: 52c1664c31f13e3b5f8ff16235c10365ce61f107abf20f1b5d1d73e3d65d8fcf8eb5d50c9c8b7910d543b071f8a3908744a7b4cbee7ed666bc96b788f6a2e00f
7
+ data.tar.gz: ce85f4bc7c86201cebfacda18f45412d62064ce3ae0e1400ffe7540663fd37f8090fd5782bdea93ff072aeaaa83a385b8d9c34db3df9221ebbee7f833ad46cd0
@@ -5,7 +5,6 @@ rvm:
5
5
  - 2.2.5
6
6
  - 2.3.1
7
7
  - ruby-head
8
- - jruby-19mode
9
8
  - rbx-2
10
9
  before_install:
11
10
  - gem update --system
@@ -30,8 +29,6 @@ matrix:
30
29
  gemfile: gemfiles/5.0.gemfile
31
30
  allow_failures:
32
31
  - rvm: ruby-head
33
- - rvm: jruby-19mode
34
- gemfile: gemfiles/5.0.gemfile
35
32
  - rvm: rbx-2
36
33
  branches:
37
34
  only:
@@ -986,14 +986,12 @@ namespace :factory_bot do
986
986
  desc "Verify that all FactoryBot factories are valid"
987
987
  task lint: :environment do
988
988
  if Rails.env.test?
989
- begin
990
- DatabaseCleaner.start
989
+ DatabaseCleaner.cleaning do
991
990
  FactoryBot.lint
992
- ensure
993
- DatabaseCleaner.clean
994
991
  end
995
992
  else
996
993
  system("bundle exec rake factory_bot:lint RAILS_ENV='test'")
994
+ exit $?.exitstatus
997
995
  end
998
996
  end
999
997
  end
@@ -1030,6 +1028,12 @@ This can also be combined with other arguments:
1030
1028
  FactoryBot.lint factories_to_lint, traits: true
1031
1029
  ```
1032
1030
 
1031
+ You can also specify the strategy used for linting:
1032
+
1033
+ ```ruby
1034
+ FactoryGirl.lint strategy: :build
1035
+ ```
1036
+
1033
1037
  Custom Construction
1034
1038
  -------------------
1035
1039
 
@@ -1,24 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- factory_bot (1.0.0)
4
+ factory_bot (1.0.0.alpha)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (5.0.0.1)
11
- activesupport (= 5.0.0.1)
12
- activerecord (5.0.0.1)
13
- activemodel (= 5.0.0.1)
14
- activesupport (= 5.0.0.1)
15
- arel (~> 7.0)
16
- activerecord-jdbc-adapter (1.3.21)
17
- activerecord (>= 2.2)
18
- activerecord-jdbcsqlite3-adapter (1.3.21)
19
- activerecord-jdbc-adapter (~> 1.3.21)
20
- jdbc-sqlite3 (>= 3.7.2, < 3.9)
21
- activesupport (5.0.0.1)
10
+ activemodel (5.1.4)
11
+ activesupport (= 5.1.4)
12
+ activerecord (5.1.4)
13
+ activemodel (= 5.1.4)
14
+ activesupport (= 5.1.4)
15
+ arel (~> 8.0)
16
+ activesupport (5.1.4)
22
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
23
18
  i18n (~> 0.7)
24
19
  minitest (~> 5.1)
@@ -27,79 +22,66 @@ GEM
27
22
  bundler
28
23
  rake
29
24
  thor (>= 0.14.0)
30
- arel (7.1.4)
31
- aruba (0.13.0)
25
+ arel (8.0.0)
26
+ aruba (0.14.2)
32
27
  childprocess (~> 0.5.6)
33
28
  contracts (~> 0.9)
34
29
  cucumber (>= 1.3.19)
35
30
  ffi (~> 1.9.10)
36
31
  rspec-expectations (>= 2.99)
37
32
  thor (~> 0.19)
38
- bourne (1.6.0)
39
- mocha (~> 1.1)
40
- builder (3.2.2)
33
+ builder (3.2.3)
41
34
  childprocess (0.5.9)
42
35
  ffi (~> 1.0, >= 1.0.11)
43
- concurrent-ruby (1.0.2)
44
- concurrent-ruby (1.0.2-java)
45
- contracts (0.13.0)
36
+ concurrent-ruby (1.0.5)
37
+ contracts (0.16.0)
46
38
  cucumber (1.3.20)
47
39
  builder (>= 2.1.2)
48
40
  diff-lcs (>= 1.1.3)
49
41
  gherkin (~> 2.12)
50
42
  multi_json (>= 1.7.5, < 2.0)
51
43
  multi_test (>= 0.1.2)
52
- diff-lcs (1.2.5)
44
+ diff-lcs (1.3)
53
45
  docile (1.1.5)
54
- ffi (1.9.10)
55
- ffi (1.9.10-java)
46
+ ffi (1.9.18)
56
47
  gherkin (2.12.2)
57
48
  multi_json (~> 1.3)
58
- gherkin (2.12.2-java)
59
- multi_json (~> 1.3)
60
- i18n (0.7.0)
61
- jdbc-sqlite3 (3.8.11.2)
62
- json (1.8.3)
63
- json (1.8.3-java)
64
- metaclass (0.0.4)
65
- minitest (5.9.1)
66
- mocha (1.1.0)
67
- metaclass (~> 0.0.1)
68
- multi_json (1.11.2)
49
+ i18n (0.8.6)
50
+ json (2.1.0)
51
+ minitest (5.10.3)
52
+ multi_json (1.12.2)
69
53
  multi_test (0.1.2)
70
- rake (10.5.0)
71
- rspec (3.4.0)
72
- rspec-core (~> 3.4.0)
73
- rspec-expectations (~> 3.4.0)
74
- rspec-mocks (~> 3.4.0)
75
- rspec-core (3.4.2)
76
- rspec-support (~> 3.4.0)
77
- rspec-expectations (3.4.0)
54
+ rake (12.1.0)
55
+ rspec (3.6.0)
56
+ rspec-core (~> 3.6.0)
57
+ rspec-expectations (~> 3.6.0)
58
+ rspec-mocks (~> 3.6.0)
59
+ rspec-core (3.6.0)
60
+ rspec-support (~> 3.6.0)
61
+ rspec-expectations (3.6.0)
78
62
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.4.0)
63
+ rspec-support (~> 3.6.0)
80
64
  rspec-its (1.2.0)
81
65
  rspec-core (>= 3.0.0)
82
66
  rspec-expectations (>= 3.0.0)
83
- rspec-mocks (3.4.1)
67
+ rspec-mocks (3.6.0)
84
68
  diff-lcs (>= 1.2.0, < 2.0)
85
- rspec-support (~> 3.4.0)
86
- rspec-support (3.4.1)
87
- simplecov (0.11.2)
69
+ rspec-support (~> 3.6.0)
70
+ rspec-support (3.6.0)
71
+ simplecov (0.15.1)
88
72
  docile (~> 1.1.0)
89
- json (~> 1.8)
73
+ json (>= 1.8, < 3)
90
74
  simplecov-html (~> 0.10.0)
91
- simplecov-html (0.10.0)
92
- sqlite3 (1.3.12)
93
- thor (0.19.1)
94
- thread_safe (0.3.5)
95
- thread_safe (0.3.5-java)
96
- timecop (0.8.0)
97
- tzinfo (1.2.2)
75
+ simplecov-html (0.10.2)
76
+ sqlite3 (1.3.13)
77
+ thor (0.20.0)
78
+ thread_safe (0.3.6)
79
+ timecop (0.9.1)
80
+ tzinfo (1.2.3)
98
81
  thread_safe (~> 0.1)
99
- yard (0.8.7.6)
82
+ yard (0.9.9)
100
83
 
101
84
  PLATFORMS
102
- java
103
85
  ruby
104
86
 
105
87
  DEPENDENCIES
@@ -107,11 +89,9 @@ DEPENDENCIES
107
89
  activerecord-jdbcsqlite3-adapter
108
90
  appraisal (~> 2.1.0)
109
91
  aruba
110
- bourne
111
92
  cucumber (~> 1.3.15)
112
93
  factory_bot!
113
94
  jdbc-sqlite3
114
- mocha (>= 0.12.8)
115
95
  rspec (~> 3.0)
116
96
  rspec-its (~> 1.0)
117
97
  simplecov
@@ -120,4 +100,4 @@ DEPENDENCIES
120
100
  yard
121
101
 
122
102
  BUNDLED WITH
123
- 1.13.6
103
+ 1.15.3
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008-2016 Joe Ferris and thoughtbot, inc.
1
+ Copyright (c) 2008-2017 Joe Ferris and thoughtbot, inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/NEWS CHANGED
@@ -1,3 +1,8 @@
1
+ 4.8.1 (September 28, 2017)
2
+ Explicitly define `#destroyed?` within the `Stub` strategy to return `nil` instead of raising
3
+ Update various dependencies
4
+ Update internal test suite to use RSpec's mocking/stubbing instead of mocha
5
+
1
6
  4.8.0 (December 16, 2016)
2
7
  Improve documentation
3
8
  Add `FactoryGirl.generate_list` to be consistent with `build_list`/`create_list` and friends
data/README.md CHANGED
@@ -82,14 +82,18 @@ community](https://github.com/thoughtbot/factory_bot/graphs/contributors).
82
82
  License
83
83
  -------
84
84
 
85
+ <<<<<<< HEAD
86
+ factory_girl is Copyright © 2008-2017 Joe Ferris and thoughtbot. It is free
87
+ =======
85
88
  factory_bot is Copyright © 2008-2016 Joe Ferris and thoughtbot. It is free
89
+ >>>>>>> Replace 'girl' with 'bot' everywhere
86
90
  software, and may be redistributed under the terms specified in the
87
91
  [LICENSE](/LICENSE) file.
88
92
 
89
93
  About thoughtbot
90
94
  ----------------
91
95
 
92
- ![thoughtbot](https://thoughtbot.com/logo.png)
96
+ ![thoughtbot](http://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg)
93
97
 
94
98
  factory_bot is maintained and funded by thoughtbot, inc.
95
99
  The names and logos for thoughtbot are trademarks of thoughtbot, inc.
@@ -28,8 +28,6 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency("timecop")
29
29
  s.add_development_dependency("simplecov")
30
30
  s.add_development_dependency("aruba")
31
- s.add_development_dependency("mocha", ">= 0.12.8")
32
- s.add_development_dependency("bourne")
33
31
  s.add_development_dependency("appraisal", "~> 2.1.0")
34
32
  s.add_development_dependency("activerecord", ">= 3.0.0")
35
33
  s.add_development_dependency("yard")
@@ -1,24 +1,24 @@
1
1
  GIT
2
2
  remote: https://github.com/rails/rails.git
3
- revision: d4a1b33a2ab6703124926fbf805d77ef753e1b87
3
+ revision: e17e25cd23e8abd45b1706463dd57c90fa6dcb7c
4
4
  branch: 3-2-stable
5
5
  specs:
6
- activemodel (3.2.22.2)
7
- activesupport (= 3.2.22.2)
8
- builder (~> 3.0.0)
9
- activerecord (3.2.22.2)
10
- activemodel (= 3.2.22.2)
11
- activesupport (= 3.2.22.2)
6
+ activemodel (3.2.22.5)
7
+ activesupport (= 3.2.22.5)
8
+ builder (~> 3.0)
9
+ activerecord (3.2.22.5)
10
+ activemodel (= 3.2.22.5)
11
+ activesupport (= 3.2.22.5)
12
12
  arel (~> 3.0.2)
13
13
  tzinfo (~> 0.3.29)
14
- activesupport (3.2.22.2)
14
+ activesupport (3.2.22.5)
15
15
  i18n (~> 0.6, >= 0.6.4)
16
16
  multi_json (~> 1.0)
17
17
 
18
18
  PATH
19
19
  remote: ../
20
20
  specs:
21
- factory_girl (4.8.0)
21
+ factory_girl (4.8.1)
22
22
  activesupport (>= 3.0.0)
23
23
 
24
24
  GEM
@@ -29,64 +29,59 @@ GEM
29
29
  rake
30
30
  thor (>= 0.14.0)
31
31
  arel (3.0.3)
32
- aruba (0.14.1)
32
+ aruba (0.14.2)
33
33
  childprocess (~> 0.5.6)
34
34
  contracts (~> 0.9)
35
35
  cucumber (>= 1.3.19)
36
36
  ffi (~> 1.9.10)
37
37
  rspec-expectations (>= 2.99)
38
38
  thor (~> 0.19)
39
- bourne (1.6.0)
40
- mocha (~> 1.1)
41
- builder (3.0.4)
39
+ builder (3.2.3)
42
40
  childprocess (0.5.9)
43
41
  ffi (~> 1.0, >= 1.0.11)
44
- contracts (0.14.0)
42
+ contracts (0.16.0)
45
43
  cucumber (1.3.20)
46
44
  builder (>= 2.1.2)
47
45
  diff-lcs (>= 1.1.3)
48
46
  gherkin (~> 2.12)
49
47
  multi_json (>= 1.7.5, < 2.0)
50
48
  multi_test (>= 0.1.2)
51
- diff-lcs (1.2.5)
49
+ diff-lcs (1.3)
52
50
  docile (1.1.5)
53
- ffi (1.9.10)
51
+ ffi (1.9.18)
54
52
  gherkin (2.12.2)
55
53
  multi_json (~> 1.3)
56
- i18n (0.7.0)
57
- json (1.8.3)
58
- metaclass (0.0.4)
59
- mocha (1.1.0)
60
- metaclass (~> 0.0.1)
61
- multi_json (1.12.1)
54
+ i18n (0.8.6)
55
+ json (2.1.0)
56
+ multi_json (1.12.2)
62
57
  multi_test (0.1.2)
63
- rake (11.2.2)
64
- rspec (3.4.0)
65
- rspec-core (~> 3.4.0)
66
- rspec-expectations (~> 3.4.0)
67
- rspec-mocks (~> 3.4.0)
68
- rspec-core (3.4.4)
69
- rspec-support (~> 3.4.0)
70
- rspec-expectations (3.4.0)
58
+ rake (12.1.0)
59
+ rspec (3.6.0)
60
+ rspec-core (~> 3.6.0)
61
+ rspec-expectations (~> 3.6.0)
62
+ rspec-mocks (~> 3.6.0)
63
+ rspec-core (3.6.0)
64
+ rspec-support (~> 3.6.0)
65
+ rspec-expectations (3.6.0)
71
66
  diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.4.0)
67
+ rspec-support (~> 3.6.0)
73
68
  rspec-its (1.2.0)
74
69
  rspec-core (>= 3.0.0)
75
70
  rspec-expectations (>= 3.0.0)
76
- rspec-mocks (3.4.1)
71
+ rspec-mocks (3.6.0)
77
72
  diff-lcs (>= 1.2.0, < 2.0)
78
- rspec-support (~> 3.4.0)
79
- rspec-support (3.4.1)
80
- simplecov (0.11.2)
73
+ rspec-support (~> 3.6.0)
74
+ rspec-support (3.6.0)
75
+ simplecov (0.15.1)
81
76
  docile (~> 1.1.0)
82
- json (~> 1.8)
77
+ json (>= 1.8, < 3)
83
78
  simplecov-html (~> 0.10.0)
84
- simplecov-html (0.10.0)
85
- sqlite3 (1.3.11)
86
- thor (0.19.1)
87
- timecop (0.8.1)
88
- tzinfo (0.3.50)
89
- yard (0.8.7.6)
79
+ simplecov-html (0.10.2)
80
+ sqlite3 (1.3.13)
81
+ thor (0.20.0)
82
+ timecop (0.9.1)
83
+ tzinfo (0.3.53)
84
+ yard (0.9.9)
90
85
 
91
86
  PLATFORMS
92
87
  ruby
@@ -96,11 +91,9 @@ DEPENDENCIES
96
91
  activerecord-jdbcsqlite3-adapter
97
92
  appraisal (~> 2.1.0)
98
93
  aruba
99
- bourne
100
94
  cucumber (~> 1.3.15)
101
95
  factory_girl!
102
96
  jdbc-sqlite3
103
- mocha (>= 0.12.8)
104
97
  rspec (~> 3.0)
105
98
  rspec-its (~> 1.0)
106
99
  simplecov
@@ -109,4 +102,4 @@ DEPENDENCIES
109
102
  yard
110
103
 
111
104
  BUNDLED WITH
112
- 1.13.6
105
+ 1.15.4
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- factory_girl (4.8.0)
4
+ factory_girl (4.8.1)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -27,66 +27,61 @@ GEM
27
27
  rake
28
28
  thor (>= 0.14.0)
29
29
  arel (4.0.2)
30
- aruba (0.14.1)
30
+ aruba (0.14.2)
31
31
  childprocess (~> 0.5.6)
32
32
  contracts (~> 0.9)
33
33
  cucumber (>= 1.3.19)
34
34
  ffi (~> 1.9.10)
35
35
  rspec-expectations (>= 2.99)
36
36
  thor (~> 0.19)
37
- bourne (1.6.0)
38
- mocha (~> 1.1)
39
37
  builder (3.1.4)
40
38
  childprocess (0.5.9)
41
39
  ffi (~> 1.0, >= 1.0.11)
42
- contracts (0.14.0)
40
+ contracts (0.16.0)
43
41
  cucumber (1.3.20)
44
42
  builder (>= 2.1.2)
45
43
  diff-lcs (>= 1.1.3)
46
44
  gherkin (~> 2.12)
47
45
  multi_json (>= 1.7.5, < 2.0)
48
46
  multi_test (>= 0.1.2)
49
- diff-lcs (1.2.5)
47
+ diff-lcs (1.3)
50
48
  docile (1.1.5)
51
- ffi (1.9.10)
49
+ ffi (1.9.18)
52
50
  gherkin (2.12.2)
53
51
  multi_json (~> 1.3)
54
- i18n (0.7.0)
55
- json (1.8.3)
56
- metaclass (0.0.4)
52
+ i18n (0.8.6)
53
+ json (2.1.0)
57
54
  minitest (4.7.5)
58
- mocha (1.1.0)
59
- metaclass (~> 0.0.1)
60
- multi_json (1.12.1)
55
+ multi_json (1.12.2)
61
56
  multi_test (0.1.2)
62
- rake (11.2.2)
63
- rspec (3.4.0)
64
- rspec-core (~> 3.4.0)
65
- rspec-expectations (~> 3.4.0)
66
- rspec-mocks (~> 3.4.0)
67
- rspec-core (3.4.4)
68
- rspec-support (~> 3.4.0)
69
- rspec-expectations (3.4.0)
57
+ rake (12.1.0)
58
+ rspec (3.6.0)
59
+ rspec-core (~> 3.6.0)
60
+ rspec-expectations (~> 3.6.0)
61
+ rspec-mocks (~> 3.6.0)
62
+ rspec-core (3.6.0)
63
+ rspec-support (~> 3.6.0)
64
+ rspec-expectations (3.6.0)
70
65
  diff-lcs (>= 1.2.0, < 2.0)
71
- rspec-support (~> 3.4.0)
66
+ rspec-support (~> 3.6.0)
72
67
  rspec-its (1.2.0)
73
68
  rspec-core (>= 3.0.0)
74
69
  rspec-expectations (>= 3.0.0)
75
- rspec-mocks (3.4.1)
70
+ rspec-mocks (3.6.0)
76
71
  diff-lcs (>= 1.2.0, < 2.0)
77
- rspec-support (~> 3.4.0)
78
- rspec-support (3.4.1)
79
- simplecov (0.11.2)
72
+ rspec-support (~> 3.6.0)
73
+ rspec-support (3.6.0)
74
+ simplecov (0.15.1)
80
75
  docile (~> 1.1.0)
81
- json (~> 1.8)
76
+ json (>= 1.8, < 3)
82
77
  simplecov-html (~> 0.10.0)
83
- simplecov-html (0.10.0)
84
- sqlite3 (1.3.11)
85
- thor (0.19.1)
86
- thread_safe (0.3.5)
87
- timecop (0.8.1)
88
- tzinfo (0.3.50)
89
- yard (0.8.7.6)
78
+ simplecov-html (0.10.2)
79
+ sqlite3 (1.3.13)
80
+ thor (0.20.0)
81
+ thread_safe (0.3.6)
82
+ timecop (0.9.1)
83
+ tzinfo (0.3.53)
84
+ yard (0.9.9)
90
85
 
91
86
  PLATFORMS
92
87
  ruby
@@ -96,11 +91,9 @@ DEPENDENCIES
96
91
  activerecord-jdbcsqlite3-adapter
97
92
  appraisal (~> 2.1.0)
98
93
  aruba
99
- bourne
100
94
  cucumber (~> 1.3.15)
101
95
  factory_girl!
102
96
  jdbc-sqlite3
103
- mocha (>= 0.12.8)
104
97
  rspec (~> 3.0)
105
98
  rspec-its (~> 1.0)
106
99
  simplecov
@@ -109,4 +102,4 @@ DEPENDENCIES
109
102
  yard
110
103
 
111
104
  BUNDLED WITH
112
- 1.13.6
105
+ 1.15.4
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- factory_girl (4.8.0)
4
+ factory_girl (4.8.1)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (4.1.15)
11
- activesupport (= 4.1.15)
10
+ activemodel (4.1.16)
11
+ activesupport (= 4.1.16)
12
12
  builder (~> 3.1)
13
- activerecord (4.1.15)
14
- activemodel (= 4.1.15)
15
- activesupport (= 4.1.15)
13
+ activerecord (4.1.16)
14
+ activemodel (= 4.1.16)
15
+ activesupport (= 4.1.16)
16
16
  arel (~> 5.0.0)
17
- activesupport (4.1.15)
17
+ activesupport (4.1.16)
18
18
  i18n (~> 0.6, >= 0.6.9)
19
19
  json (~> 1.7, >= 1.7.7)
20
20
  minitest (~> 5.1)
@@ -25,67 +25,62 @@ GEM
25
25
  rake
26
26
  thor (>= 0.14.0)
27
27
  arel (5.0.1.20140414130214)
28
- aruba (0.14.1)
28
+ aruba (0.14.2)
29
29
  childprocess (~> 0.5.6)
30
30
  contracts (~> 0.9)
31
31
  cucumber (>= 1.3.19)
32
32
  ffi (~> 1.9.10)
33
33
  rspec-expectations (>= 2.99)
34
34
  thor (~> 0.19)
35
- bourne (1.6.0)
36
- mocha (~> 1.1)
37
- builder (3.2.2)
35
+ builder (3.2.3)
38
36
  childprocess (0.5.9)
39
37
  ffi (~> 1.0, >= 1.0.11)
40
- contracts (0.14.0)
38
+ contracts (0.16.0)
41
39
  cucumber (1.3.20)
42
40
  builder (>= 2.1.2)
43
41
  diff-lcs (>= 1.1.3)
44
42
  gherkin (~> 2.12)
45
43
  multi_json (>= 1.7.5, < 2.0)
46
44
  multi_test (>= 0.1.2)
47
- diff-lcs (1.2.5)
45
+ diff-lcs (1.3)
48
46
  docile (1.1.5)
49
- ffi (1.9.10)
47
+ ffi (1.9.18)
50
48
  gherkin (2.12.2)
51
49
  multi_json (~> 1.3)
52
- i18n (0.7.0)
53
- json (1.8.3)
54
- metaclass (0.0.4)
55
- minitest (5.9.0)
56
- mocha (1.1.0)
57
- metaclass (~> 0.0.1)
58
- multi_json (1.12.1)
50
+ i18n (0.8.6)
51
+ json (1.8.6)
52
+ minitest (5.10.3)
53
+ multi_json (1.12.2)
59
54
  multi_test (0.1.2)
60
- rake (11.2.2)
61
- rspec (3.4.0)
62
- rspec-core (~> 3.4.0)
63
- rspec-expectations (~> 3.4.0)
64
- rspec-mocks (~> 3.4.0)
65
- rspec-core (3.4.4)
66
- rspec-support (~> 3.4.0)
67
- rspec-expectations (3.4.0)
55
+ rake (12.1.0)
56
+ rspec (3.6.0)
57
+ rspec-core (~> 3.6.0)
58
+ rspec-expectations (~> 3.6.0)
59
+ rspec-mocks (~> 3.6.0)
60
+ rspec-core (3.6.0)
61
+ rspec-support (~> 3.6.0)
62
+ rspec-expectations (3.6.0)
68
63
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.4.0)
64
+ rspec-support (~> 3.6.0)
70
65
  rspec-its (1.2.0)
71
66
  rspec-core (>= 3.0.0)
72
67
  rspec-expectations (>= 3.0.0)
73
- rspec-mocks (3.4.1)
68
+ rspec-mocks (3.6.0)
74
69
  diff-lcs (>= 1.2.0, < 2.0)
75
- rspec-support (~> 3.4.0)
76
- rspec-support (3.4.1)
77
- simplecov (0.11.2)
70
+ rspec-support (~> 3.6.0)
71
+ rspec-support (3.6.0)
72
+ simplecov (0.15.1)
78
73
  docile (~> 1.1.0)
79
- json (~> 1.8)
74
+ json (>= 1.8, < 3)
80
75
  simplecov-html (~> 0.10.0)
81
- simplecov-html (0.10.0)
82
- sqlite3 (1.3.11)
83
- thor (0.19.1)
84
- thread_safe (0.3.5)
85
- timecop (0.8.1)
86
- tzinfo (1.2.2)
76
+ simplecov-html (0.10.2)
77
+ sqlite3 (1.3.13)
78
+ thor (0.20.0)
79
+ thread_safe (0.3.6)
80
+ timecop (0.9.1)
81
+ tzinfo (1.2.3)
87
82
  thread_safe (~> 0.1)
88
- yard (0.8.7.6)
83
+ yard (0.9.9)
89
84
 
90
85
  PLATFORMS
91
86
  ruby
@@ -95,11 +90,9 @@ DEPENDENCIES
95
90
  activerecord-jdbcsqlite3-adapter
96
91
  appraisal (~> 2.1.0)
97
92
  aruba
98
- bourne
99
93
  cucumber (~> 1.3.15)
100
94
  factory_girl!
101
95
  jdbc-sqlite3
102
- mocha (>= 0.12.8)
103
96
  rspec (~> 3.0)
104
97
  rspec-its (~> 1.0)
105
98
  simplecov
@@ -108,4 +101,4 @@ DEPENDENCIES
108
101
  yard
109
102
 
110
103
  BUNDLED WITH
111
- 1.13.6
104
+ 1.15.4
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- factory_girl (4.8.0)
4
+ factory_girl (4.8.1)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (4.2.5.1)
11
- activesupport (= 4.2.5.1)
10
+ activemodel (4.2.5.2)
11
+ activesupport (= 4.2.5.2)
12
12
  builder (~> 3.1)
13
- activerecord (4.2.5.1)
14
- activemodel (= 4.2.5.1)
15
- activesupport (= 4.2.5.1)
13
+ activerecord (4.2.5.2)
14
+ activemodel (= 4.2.5.2)
15
+ activesupport (= 4.2.5.2)
16
16
  arel (~> 6.0)
17
- activesupport (4.2.5.1)
17
+ activesupport (4.2.5.2)
18
18
  i18n (~> 0.7)
19
19
  json (~> 1.7, >= 1.7.7)
20
20
  minitest (~> 5.1)
@@ -24,68 +24,63 @@ GEM
24
24
  bundler
25
25
  rake
26
26
  thor (>= 0.14.0)
27
- arel (6.0.3)
28
- aruba (0.14.1)
27
+ arel (6.0.4)
28
+ aruba (0.14.2)
29
29
  childprocess (~> 0.5.6)
30
30
  contracts (~> 0.9)
31
31
  cucumber (>= 1.3.19)
32
32
  ffi (~> 1.9.10)
33
33
  rspec-expectations (>= 2.99)
34
34
  thor (~> 0.19)
35
- bourne (1.6.0)
36
- mocha (~> 1.1)
37
- builder (3.2.2)
35
+ builder (3.2.3)
38
36
  childprocess (0.5.9)
39
37
  ffi (~> 1.0, >= 1.0.11)
40
- contracts (0.14.0)
38
+ contracts (0.16.0)
41
39
  cucumber (1.3.20)
42
40
  builder (>= 2.1.2)
43
41
  diff-lcs (>= 1.1.3)
44
42
  gherkin (~> 2.12)
45
43
  multi_json (>= 1.7.5, < 2.0)
46
44
  multi_test (>= 0.1.2)
47
- diff-lcs (1.2.5)
45
+ diff-lcs (1.3)
48
46
  docile (1.1.5)
49
- ffi (1.9.10)
47
+ ffi (1.9.18)
50
48
  gherkin (2.12.2)
51
49
  multi_json (~> 1.3)
52
- i18n (0.7.0)
53
- json (1.8.3)
54
- metaclass (0.0.4)
55
- minitest (5.9.0)
56
- mocha (1.1.0)
57
- metaclass (~> 0.0.1)
58
- multi_json (1.12.1)
50
+ i18n (0.8.6)
51
+ json (1.8.6)
52
+ minitest (5.10.3)
53
+ multi_json (1.12.2)
59
54
  multi_test (0.1.2)
60
- rake (11.2.2)
61
- rspec (3.4.0)
62
- rspec-core (~> 3.4.0)
63
- rspec-expectations (~> 3.4.0)
64
- rspec-mocks (~> 3.4.0)
65
- rspec-core (3.4.4)
66
- rspec-support (~> 3.4.0)
67
- rspec-expectations (3.4.0)
55
+ rake (12.1.0)
56
+ rspec (3.6.0)
57
+ rspec-core (~> 3.6.0)
58
+ rspec-expectations (~> 3.6.0)
59
+ rspec-mocks (~> 3.6.0)
60
+ rspec-core (3.6.0)
61
+ rspec-support (~> 3.6.0)
62
+ rspec-expectations (3.6.0)
68
63
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.4.0)
64
+ rspec-support (~> 3.6.0)
70
65
  rspec-its (1.2.0)
71
66
  rspec-core (>= 3.0.0)
72
67
  rspec-expectations (>= 3.0.0)
73
- rspec-mocks (3.4.1)
68
+ rspec-mocks (3.6.0)
74
69
  diff-lcs (>= 1.2.0, < 2.0)
75
- rspec-support (~> 3.4.0)
76
- rspec-support (3.4.1)
77
- simplecov (0.11.2)
70
+ rspec-support (~> 3.6.0)
71
+ rspec-support (3.6.0)
72
+ simplecov (0.15.1)
78
73
  docile (~> 1.1.0)
79
- json (~> 1.8)
74
+ json (>= 1.8, < 3)
80
75
  simplecov-html (~> 0.10.0)
81
- simplecov-html (0.10.0)
82
- sqlite3 (1.3.11)
83
- thor (0.19.1)
84
- thread_safe (0.3.5)
85
- timecop (0.8.1)
86
- tzinfo (1.2.2)
76
+ simplecov-html (0.10.2)
77
+ sqlite3 (1.3.13)
78
+ thor (0.20.0)
79
+ thread_safe (0.3.6)
80
+ timecop (0.9.1)
81
+ tzinfo (1.2.3)
87
82
  thread_safe (~> 0.1)
88
- yard (0.8.7.6)
83
+ yard (0.9.9)
89
84
 
90
85
  PLATFORMS
91
86
  ruby
@@ -95,11 +90,9 @@ DEPENDENCIES
95
90
  activerecord-jdbcsqlite3-adapter
96
91
  appraisal (~> 2.1.0)
97
92
  aruba
98
- bourne
99
93
  cucumber (~> 1.3.15)
100
94
  factory_girl!
101
95
  jdbc-sqlite3
102
- mocha (>= 0.12.8)
103
96
  rspec (~> 3.0)
104
97
  rspec-its (~> 1.0)
105
98
  simplecov
@@ -108,4 +101,4 @@ DEPENDENCIES
108
101
  yard
109
102
 
110
103
  BUNDLED WITH
111
- 1.13.6
104
+ 1.15.4
@@ -1,19 +1,19 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- factory_girl (4.8.0)
4
+ factory_girl (4.8.1)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (5.0.0)
11
- activesupport (= 5.0.0)
12
- activerecord (5.0.0)
13
- activemodel (= 5.0.0)
14
- activesupport (= 5.0.0)
10
+ activemodel (5.0.6)
11
+ activesupport (= 5.0.6)
12
+ activerecord (5.0.6)
13
+ activemodel (= 5.0.6)
14
+ activesupport (= 5.0.6)
15
15
  arel (~> 7.0)
16
- activesupport (5.0.0)
16
+ activesupport (5.0.6)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (~> 0.7)
19
19
  minitest (~> 5.1)
@@ -22,69 +22,64 @@ GEM
22
22
  bundler
23
23
  rake
24
24
  thor (>= 0.14.0)
25
- arel (7.0.0)
26
- aruba (0.14.1)
25
+ arel (7.1.4)
26
+ aruba (0.14.2)
27
27
  childprocess (~> 0.5.6)
28
28
  contracts (~> 0.9)
29
29
  cucumber (>= 1.3.19)
30
30
  ffi (~> 1.9.10)
31
31
  rspec-expectations (>= 2.99)
32
32
  thor (~> 0.19)
33
- bourne (1.6.0)
34
- mocha (~> 1.1)
35
- builder (3.2.2)
33
+ builder (3.2.3)
36
34
  childprocess (0.5.9)
37
35
  ffi (~> 1.0, >= 1.0.11)
38
- concurrent-ruby (1.0.2)
39
- contracts (0.14.0)
36
+ concurrent-ruby (1.0.5)
37
+ contracts (0.16.0)
40
38
  cucumber (1.3.20)
41
39
  builder (>= 2.1.2)
42
40
  diff-lcs (>= 1.1.3)
43
41
  gherkin (~> 2.12)
44
42
  multi_json (>= 1.7.5, < 2.0)
45
43
  multi_test (>= 0.1.2)
46
- diff-lcs (1.2.5)
44
+ diff-lcs (1.3)
47
45
  docile (1.1.5)
48
- ffi (1.9.10)
46
+ ffi (1.9.18)
49
47
  gherkin (2.12.2)
50
48
  multi_json (~> 1.3)
51
- i18n (0.7.0)
52
- json (1.8.3)
53
- metaclass (0.0.4)
54
- minitest (5.9.0)
55
- mocha (1.1.0)
56
- metaclass (~> 0.0.1)
57
- multi_json (1.12.1)
49
+ i18n (0.8.6)
50
+ json (2.1.0)
51
+ minitest (5.10.3)
52
+ multi_json (1.12.2)
58
53
  multi_test (0.1.2)
59
- rake (11.2.2)
60
- rspec (3.4.0)
61
- rspec-core (~> 3.4.0)
62
- rspec-expectations (~> 3.4.0)
63
- rspec-mocks (~> 3.4.0)
64
- rspec-core (3.4.4)
65
- rspec-support (~> 3.4.0)
66
- rspec-expectations (3.4.0)
54
+ rake (12.1.0)
55
+ rspec (3.6.0)
56
+ rspec-core (~> 3.6.0)
57
+ rspec-expectations (~> 3.6.0)
58
+ rspec-mocks (~> 3.6.0)
59
+ rspec-core (3.6.0)
60
+ rspec-support (~> 3.6.0)
61
+ rspec-expectations (3.6.0)
67
62
  diff-lcs (>= 1.2.0, < 2.0)
68
- rspec-support (~> 3.4.0)
63
+ rspec-support (~> 3.6.0)
69
64
  rspec-its (1.2.0)
70
65
  rspec-core (>= 3.0.0)
71
66
  rspec-expectations (>= 3.0.0)
72
- rspec-mocks (3.4.1)
67
+ rspec-mocks (3.6.0)
73
68
  diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.4.0)
75
- rspec-support (3.4.1)
76
- simplecov (0.11.2)
69
+ rspec-support (~> 3.6.0)
70
+ rspec-support (3.6.0)
71
+ simplecov (0.15.1)
77
72
  docile (~> 1.1.0)
78
- json (~> 1.8)
73
+ json (>= 1.8, < 3)
79
74
  simplecov-html (~> 0.10.0)
80
- simplecov-html (0.10.0)
81
- sqlite3 (1.3.11)
82
- thor (0.19.1)
83
- thread_safe (0.3.5)
84
- timecop (0.8.1)
85
- tzinfo (1.2.2)
75
+ simplecov-html (0.10.2)
76
+ sqlite3 (1.3.13)
77
+ thor (0.20.0)
78
+ thread_safe (0.3.6)
79
+ timecop (0.9.1)
80
+ tzinfo (1.2.3)
86
81
  thread_safe (~> 0.1)
87
- yard (0.8.7.6)
82
+ yard (0.9.9)
88
83
 
89
84
  PLATFORMS
90
85
  ruby
@@ -94,11 +89,9 @@ DEPENDENCIES
94
89
  activerecord-jdbcsqlite3-adapter
95
90
  appraisal (~> 2.1.0)
96
91
  aruba
97
- bourne
98
92
  cucumber (~> 1.3.15)
99
93
  factory_girl!
100
94
  jdbc-sqlite3
101
- mocha (>= 0.12.8)
102
95
  rspec (~> 3.0)
103
96
  rspec-its (~> 1.0)
104
97
  simplecov
@@ -107,4 +100,4 @@ DEPENDENCIES
107
100
  yard
108
101
 
109
102
  BUNDLED WITH
110
- 1.13.6
103
+ 1.15.4
@@ -59,12 +59,14 @@ module FactoryBot
59
59
  # Parameters:
60
60
  # factories - which factories to lint; omit for all factories
61
61
  # options:
62
- # traits : true - to lint traits as well as factories
62
+ # traits: true - to lint traits as well as factories
63
+ # strategy: :create - to specify the strategy for linting
63
64
  def self.lint(*args)
64
65
  options = args.extract_options!
65
66
  factories_to_lint = args[0] || FactoryBot.factories
66
- strategy = options[:traits] ? :factory_and_traits : :factory
67
- Linter.new(factories_to_lint, strategy).lint!
67
+ linting_strategy = options[:traits] ? :factory_and_traits : :factory
68
+ factory_strategy = options[:strategy] || :create
69
+ Linter.new(factories_to_lint, linting_strategy, factory_strategy).lint!
68
70
  end
69
71
 
70
72
  class << self
@@ -4,7 +4,8 @@ module FactoryBot
4
4
  class Evaluation
5
5
  include Observable
6
6
 
7
- def initialize(attribute_assigner, to_create)
7
+ def initialize(evaluator, attribute_assigner, to_create)
8
+ @evaluator = evaluator
8
9
  @attribute_assigner = attribute_assigner
9
10
  @to_create = to_create
10
11
  end
@@ -12,7 +13,10 @@ module FactoryBot
12
13
  delegate :object, :hash, to: :@attribute_assigner
13
14
 
14
15
  def create(result_instance)
15
- @to_create[result_instance]
16
+ case @to_create.arity
17
+ when 2 then @to_create[result_instance, @evaluator]
18
+ else @to_create[result_instance]
19
+ end
16
20
  end
17
21
 
18
22
  def notify(name, result_instance)
@@ -36,7 +36,8 @@ module FactoryBot
36
36
  evaluator = evaluator_class.new(strategy, overrides.symbolize_keys)
37
37
  attribute_assigner = AttributeAssigner.new(evaluator, build_class, &compiled_constructor)
38
38
 
39
- evaluation = Evaluation.new(attribute_assigner, compiled_to_create)
39
+ evaluation =
40
+ Evaluation.new(evaluator, attribute_assigner, compiled_to_create)
40
41
  evaluation.add_observer(CallbacksObserver.new(callbacks, evaluator))
41
42
 
42
43
  strategy.result(evaluation).tap(&block)
@@ -1,9 +1,10 @@
1
1
  module FactoryBot
2
2
  class Linter
3
3
 
4
- def initialize(factories_to_lint, linting_strategy)
5
- @factories_to_lint = factories_to_lint
4
+ def initialize(factories, linting_strategy, factory_strategy = :create)
5
+ @factories_to_lint = factories
6
6
  @linting_method = "lint_#{linting_strategy}"
7
+ @factory_strategy = factory_strategy
7
8
  @invalid_factories = calculate_invalid_factories
8
9
  end
9
10
 
@@ -13,11 +14,10 @@ module FactoryBot
13
14
  end
14
15
  end
15
16
 
16
- attr_reader :factories_to_lint, :invalid_factories
17
- private :factories_to_lint, :invalid_factories
18
-
19
17
  private
20
18
 
19
+ attr_reader :factories_to_lint, :invalid_factories, :factory_strategy
20
+
21
21
  def calculate_invalid_factories
22
22
  factories_to_lint.reduce(Hash.new([])) do |result, factory|
23
23
  errors = send(@linting_method, factory)
@@ -56,7 +56,7 @@ module FactoryBot
56
56
  def lint_factory(factory)
57
57
  result = []
58
58
  begin
59
- FactoryBot.create(factory.name)
59
+ FactoryBot.public_send(factory_strategy, factory.name)
60
60
  rescue => error
61
61
  result |= [FactoryError.new(error, factory)]
62
62
  end
@@ -67,7 +67,7 @@ module FactoryBot
67
67
  result = []
68
68
  factory.definition.defined_traits.map(&:name).each do |trait_name|
69
69
  begin
70
- FactoryBot.create(factory.name, trait_name)
70
+ FactoryBot.public_send(factory_strategy, factory.name, trait_name)
71
71
  rescue => error
72
72
  result |=
73
73
  [FactoryTraitError.new(error, factory, trait_name)]
@@ -10,7 +10,6 @@ module FactoryBot
10
10
  :delete,
11
11
  :destroy!,
12
12
  :destroy,
13
- :destroyed?,
14
13
  :increment!,
15
14
  :increment,
16
15
  :reload,
@@ -58,6 +57,10 @@ module FactoryBot
58
57
  id.nil?
59
58
  end
60
59
 
60
+ def destroyed?
61
+ nil
62
+ end
63
+
61
64
  DISABLED_PERSISTENCE_METHODS.each do |write_method|
62
65
  define_singleton_method(write_method) do |*args|
63
66
  raise "stubbed models are not allowed to access the database - #{self.class}##{write_method}(#{args.join(",")})"
@@ -1,3 +1,3 @@
1
1
  module FactoryBot
2
- VERSION = '1.0.0.alpha'.freeze
2
+ VERSION = '1.0.1.alpha'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha
4
+ version: 1.0.1.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Clayton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-27 00:00:00.000000000 Z
12
+ date: 2017-10-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -109,34 +109,6 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
- - !ruby/object:Gem::Dependency
113
- name: mocha
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- version: 0.12.8
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: 0.12.8
126
- - !ruby/object:Gem::Dependency
127
- name: bourne
128
- requirement: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: '0'
133
- type: :development
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- version: '0'
140
112
  - !ruby/object:Gem::Dependency
141
113
  name: appraisal
142
114
  requirement: !ruby/object:Gem::Requirement
@@ -294,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
266
  version: 1.3.1
295
267
  requirements: []
296
268
  rubyforge_project:
297
- rubygems_version: 2.5.1
269
+ rubygems_version: 2.6.11
298
270
  signing_key:
299
271
  specification_version: 4
300
272
  summary: factory_bot provides a framework and DSL for defining and using model instance