factory_girl 4.8.0 → 4.9.0

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
  SHA1:
3
- metadata.gz: b54b15d2754297ebbbe0bfae279af379d149cb14
4
- data.tar.gz: e1704ba19386de1e4f10949b5239e5b8bb7374b7
3
+ metadata.gz: e16a4a30eb303ecf77779a64966bb5542f4f1a19
4
+ data.tar.gz: a4a44676d4602a413fe5447d6a78ac62f8fd9a77
5
5
  SHA512:
6
- metadata.gz: 084c3630e60c5bb99fd839e840c42d0012d647e4f3dd76b2737f979013d09740877aee5900130f59beca69cef1f76cd7a78613edc3d18c43e3879d2d52808af7
7
- data.tar.gz: 073011ae6b9398b2b3961374181b5b1ec32711a96b1989bf0bb563b7df26f566442312cf9d64ce0e5824f5a9d835c6f3193b61982a0cec9f5dd72b29b6dc42c3
6
+ metadata.gz: 95d58dc9a5f1aa320431927c7a84af285c96d0cb7cd8a3ae0ee124658d7bff391f304e5977ac12c2f87f93b3bf0f0c816912c4b714c2dbc305657e5ecab64b90
7
+ data.tar.gz: 33928a2fc80baa62226a3a83fa19f144debe62b56cb047c88d511b2267ecd74f844f08d2083b9e2160f4d90fc7163be67fd167c98ffadc80101f0b1b63174bc6
data/.travis.yml CHANGED
@@ -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:
data/GETTING_STARTED.md CHANGED
@@ -986,14 +986,12 @@ namespace :factory_girl do
986
986
  desc "Verify that all FactoryGirl 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
  FactoryGirl.lint
992
- ensure
993
- DatabaseCleaner.clean
994
991
  end
995
992
  else
996
993
  system("bundle exec rake factory_girl: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
  FactoryGirl.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
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- factory_girl (4.8.0)
4
+ factory_girl (4.9.0)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -35,8 +35,6 @@ GEM
35
35
  ffi (~> 1.9.10)
36
36
  rspec-expectations (>= 2.99)
37
37
  thor (~> 0.19)
38
- bourne (1.6.0)
39
- mocha (~> 1.1)
40
38
  builder (3.2.2)
41
39
  childprocess (0.5.9)
42
40
  ffi (~> 1.0, >= 1.0.11)
@@ -59,12 +57,9 @@ GEM
59
57
  multi_json (~> 1.3)
60
58
  i18n (0.7.0)
61
59
  jdbc-sqlite3 (3.8.11.2)
62
- json (1.8.3)
63
- json (1.8.3-java)
64
- metaclass (0.0.4)
60
+ json (1.8.6)
61
+ json (1.8.6-java)
65
62
  minitest (5.9.1)
66
- mocha (1.1.0)
67
- metaclass (~> 0.0.1)
68
63
  multi_json (1.11.2)
69
64
  multi_test (0.1.2)
70
65
  rake (10.5.0)
@@ -107,11 +102,9 @@ DEPENDENCIES
107
102
  activerecord-jdbcsqlite3-adapter
108
103
  appraisal (~> 2.1.0)
109
104
  aruba
110
- bourne
111
105
  cucumber (~> 1.3.15)
112
106
  factory_girl!
113
107
  jdbc-sqlite3
114
- mocha (>= 0.12.8)
115
108
  rspec (~> 3.0)
116
109
  rspec-its (~> 1.0)
117
110
  simplecov
@@ -120,4 +113,4 @@ DEPENDENCIES
120
113
  yard
121
114
 
122
115
  BUNDLED WITH
123
- 1.13.6
116
+ 1.15.4
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,11 @@
1
+ 4.9.0 (October 23, 2017)
2
+ Deprecate factory_girl in favor of factory_bot
3
+
4
+ 4.8.1 (September 28, 2017)
5
+ Explicitly define `#destroyed?` within the `Stub` strategy to return `nil` instead of raising
6
+ Update various dependencies
7
+ Update internal test suite to use RSpec's mocking/stubbing instead of mocha
8
+
1
9
  4.8.0 (December 16, 2016)
2
10
  Improve documentation
3
11
  Add `FactoryGirl.generate_list` to be consistent with `build_list`/`create_list` and friends
data/README.md CHANGED
@@ -78,14 +78,14 @@ community](https://github.com/thoughtbot/factory_girl/graphs/contributors).
78
78
  License
79
79
  -------
80
80
 
81
- factory_girl is Copyright © 2008-2016 Joe Ferris and thoughtbot. It is free
81
+ factory_girl is Copyright © 2008-2017 Joe Ferris and thoughtbot. It is free
82
82
  software, and may be redistributed under the terms specified in the
83
83
  [LICENSE](/LICENSE) file.
84
84
 
85
85
  About thoughtbot
86
86
  ----------------
87
87
 
88
- ![thoughtbot](https://thoughtbot.com/logo.png)
88
+ ![thoughtbot](http://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg)
89
89
 
90
90
  factory_girl is maintained and funded by thoughtbot, inc.
91
91
  The names and logos for thoughtbot are trademarks of thoughtbot, inc.
@@ -0,0 +1,48 @@
1
+ # Upgrade from factory\_girl
2
+
3
+ Upgrading your codebase should involve only a few steps, and in most cases, it
4
+ involves updating the Gemfile, factories file(s), and support file configuring
5
+ the testing framework.
6
+
7
+ ## Modify your Gemfile
8
+
9
+ Replace references to factory\_girl\_rails or factory\_girl with
10
+ factory\_bot\_rails or factory\_bot. Both new gems are available starting at
11
+ version 4.8.2.
12
+
13
+ ```ruby
14
+ # Gemfile
15
+
16
+ # old
17
+ group :development, :test do
18
+ gem "factory_girl_rails"
19
+ # or
20
+ gem "factory_girl"
21
+ end
22
+
23
+ # new
24
+ group :development, :test do
25
+ gem "factory_bot_rails"
26
+ # or
27
+ gem "factory_bot"
28
+ end
29
+ ```
30
+
31
+ ## Replace All Constant References
32
+
33
+ A global find-and-replace of `FactoryGirl` to `FactoryBot` across the codebase
34
+ to replace all references with the new constant should do the trick. For
35
+ example, on OS X:
36
+
37
+ ```sh
38
+ grep -e FactoryGirl **/*.rake **/*.rb -l | xargs sed -i "" "s|FactoryGirl|FactoryBot|"
39
+ ```
40
+
41
+ ## Replace All Path References
42
+
43
+ If you're requiring files from factory\_girl or factory\_girl\_rails directly,
44
+ you'll have to update the paths.
45
+
46
+ ```sh
47
+ grep -e factory_girl **/*.rake **/*.rb -l | xargs sed -i "" "s|factory_girl|factory_bot|"
48
+ ```
data/factory_girl.gemspec CHANGED
@@ -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.9.0)
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.9.0)
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.9.0)
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.9.0)
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.9.0)
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
@@ -4,7 +4,8 @@ module FactoryGirl
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 FactoryGirl
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 FactoryGirl
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 FactoryGirl
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 FactoryGirl
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 FactoryGirl
56
56
  def lint_factory(factory)
57
57
  result = []
58
58
  begin
59
- FactoryGirl.create(factory.name)
59
+ FactoryGirl.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 FactoryGirl
67
67
  result = []
68
68
  factory.definition.defined_traits.map(&:name).each do |trait_name|
69
69
  begin
70
- FactoryGirl.create(factory.name, trait_name)
70
+ FactoryGirl.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 FactoryGirl
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 FactoryGirl
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 FactoryGirl
2
- VERSION = '4.8.0'.freeze
2
+ VERSION = '4.9.0'.freeze
3
3
  end
data/lib/factory_girl.rb CHANGED
@@ -59,12 +59,14 @@ module FactoryGirl
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] || FactoryGirl.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
@@ -152,3 +154,5 @@ end
152
154
 
153
155
  FactoryGirl.register_default_strategies
154
156
  FactoryGirl.register_default_callbacks
157
+
158
+ ActiveSupport::Deprecation.warn "The factory_girl gem is deprecated. Please upgrade to factory_bot. See https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md for further instructions."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_girl
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.0
4
+ version: 4.9.0
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: 2016-12-16 00:00:00.000000000 Z
12
+ date: 2017-10-23 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
@@ -206,6 +178,7 @@ files:
206
178
  - NEWS
207
179
  - README.md
208
180
  - Rakefile
181
+ - UPGRADE_FROM_FACTORY_GIRL.md
209
182
  - cucumber.yml
210
183
  - factory_girl.gemspec
211
184
  - gemfiles/3.2.gemfile
@@ -291,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
264
  version: '0'
292
265
  requirements: []
293
266
  rubyforge_project:
294
- rubygems_version: 2.6.4
267
+ rubygems_version: 2.5.2
295
268
  signing_key:
296
269
  specification_version: 4
297
270
  summary: factory_girl provides a framework and DSL for defining and using model instance