factory_bot_rails 1.0.0.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 +7 -0
- data/Appraisals +21 -0
- data/CONTRIBUTING.md +39 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +144 -0
- data/LICENSE +19 -0
- data/NEWS +24 -0
- data/README.md +94 -0
- data/Rakefile +24 -0
- data/bin/setup +16 -0
- data/factory_bot_rails-1.0.0.gem +0 -0
- data/factory_bot_rails.gemspec +20 -0
- data/factory_girl_rails.gemspec +20 -0
- data/features/fixture_replacement_config.feature +132 -0
- data/features/generators.feature +54 -0
- data/features/load_definitions.feature +85 -0
- data/features/step_definitions/appraisal.rb +5 -0
- data/features/step_definitions/rails_steps.rb +42 -0
- data/features/support/env.rb +21 -0
- data/gemfiles/rails3.2.gemfile +22 -0
- data/gemfiles/rails3.2.gemfile.lock +177 -0
- data/gemfiles/rails4.1.gemfile +23 -0
- data/gemfiles/rails4.1.gemfile.lock +175 -0
- data/gemfiles/rails4.2.gemfile +21 -0
- data/gemfiles/rails4.2.gemfile.lock +190 -0
- data/gemfiles/rails5.0.gemfile +22 -0
- data/gemfiles/rails5.0.gemfile.lock +153 -0
- data/lib/factory_bot_rails.rb +4 -0
- data/lib/factory_bot_rails/generator.rb +43 -0
- data/lib/factory_bot_rails/generators/non_rspec_generator.rb +19 -0
- data/lib/factory_bot_rails/generators/null_generator.rb +11 -0
- data/lib/factory_bot_rails/generators/rspec_generator.rb +23 -0
- data/lib/factory_bot_rails/railtie.rb +28 -0
- data/lib/generators/factory_bot.rb +15 -0
- data/lib/generators/factory_bot/model/model_generator.rb +99 -0
- data/tmp/aruba/testapp/Gemfile +50 -0
- data/tmp/aruba/testapp/Gemfile.lock +188 -0
- data/tmp/aruba/testapp/README.md +24 -0
- data/tmp/aruba/testapp/Rakefile +6 -0
- data/tmp/aruba/testapp/app/assets/config/manifest.js +3 -0
- data/tmp/aruba/testapp/app/assets/javascripts/application.js +16 -0
- data/tmp/aruba/testapp/app/assets/javascripts/cable.js +13 -0
- data/tmp/aruba/testapp/app/assets/stylesheets/application.css +15 -0
- data/tmp/aruba/testapp/app/channels/application_cable/channel.rb +4 -0
- data/tmp/aruba/testapp/app/channels/application_cable/connection.rb +4 -0
- data/tmp/aruba/testapp/app/controllers/application_controller.rb +3 -0
- data/tmp/aruba/testapp/app/helpers/application_helper.rb +2 -0
- data/tmp/aruba/testapp/app/jobs/application_job.rb +2 -0
- data/tmp/aruba/testapp/app/mailers/application_mailer.rb +4 -0
- data/tmp/aruba/testapp/app/models/application_record.rb +3 -0
- data/tmp/aruba/testapp/app/models/user.rb +2 -0
- data/tmp/aruba/testapp/app/views/layouts/application.html.erb +14 -0
- data/tmp/aruba/testapp/app/views/layouts/mailer.html.erb +13 -0
- data/tmp/aruba/testapp/app/views/layouts/mailer.text.erb +1 -0
- data/tmp/aruba/testapp/bin/bundle +3 -0
- data/tmp/aruba/testapp/bin/rails +9 -0
- data/tmp/aruba/testapp/bin/rake +9 -0
- data/tmp/aruba/testapp/bin/setup +34 -0
- data/tmp/aruba/testapp/bin/spring +17 -0
- data/tmp/aruba/testapp/bin/update +29 -0
- data/tmp/aruba/testapp/config.ru +5 -0
- data/tmp/aruba/testapp/config/application.rb +16 -0
- data/tmp/aruba/testapp/config/boot.rb +3 -0
- data/tmp/aruba/testapp/config/cable.yml +9 -0
- data/tmp/aruba/testapp/config/database.yml +25 -0
- data/tmp/aruba/testapp/config/environment.rb +5 -0
- data/tmp/aruba/testapp/config/environments/development.rb +54 -0
- data/tmp/aruba/testapp/config/environments/production.rb +86 -0
- data/tmp/aruba/testapp/config/environments/test.rb +42 -0
- data/tmp/aruba/testapp/config/initializers/application_controller_renderer.rb +6 -0
- data/tmp/aruba/testapp/config/initializers/assets.rb +11 -0
- data/tmp/aruba/testapp/config/initializers/backtrace_silencers.rb +7 -0
- data/tmp/aruba/testapp/config/initializers/cookies_serializer.rb +5 -0
- data/tmp/aruba/testapp/config/initializers/filter_parameter_logging.rb +4 -0
- data/tmp/aruba/testapp/config/initializers/inflections.rb +16 -0
- data/tmp/aruba/testapp/config/initializers/mime_types.rb +4 -0
- data/tmp/aruba/testapp/config/initializers/new_framework_defaults.rb +24 -0
- data/tmp/aruba/testapp/config/initializers/session_store.rb +3 -0
- data/tmp/aruba/testapp/config/initializers/wrap_parameters.rb +14 -0
- data/tmp/aruba/testapp/config/locales/en.yml +23 -0
- data/tmp/aruba/testapp/config/puma.rb +47 -0
- data/tmp/aruba/testapp/config/routes.rb +3 -0
- data/tmp/aruba/testapp/config/secrets.yml +22 -0
- data/tmp/aruba/testapp/config/spring.rb +6 -0
- data/tmp/aruba/testapp/db/development.sqlite3 +0 -0
- data/tmp/aruba/testapp/db/migrate/1_create_users.rb +7 -0
- data/tmp/aruba/testapp/db/schema.rb +19 -0
- data/tmp/aruba/testapp/db/seeds.rb +7 -0
- data/tmp/aruba/testapp/db/test.sqlite3 +0 -0
- data/tmp/aruba/testapp/lib/some_railtie/factories.rb +5 -0
- data/tmp/aruba/testapp/lib/some_railtie/railties.rb +8 -0
- data/tmp/aruba/testapp/log/development.log +16 -0
- data/tmp/aruba/testapp/log/test.log +21 -0
- data/tmp/aruba/testapp/public/404.html +67 -0
- data/tmp/aruba/testapp/public/422.html +67 -0
- data/tmp/aruba/testapp/public/500.html +66 -0
- data/tmp/aruba/testapp/public/apple-touch-icon-precomposed.png +0 -0
- data/tmp/aruba/testapp/public/apple-touch-icon.png +0 -0
- data/tmp/aruba/testapp/public/favicon.ico +0 -0
- data/tmp/aruba/testapp/public/robots.txt +5 -0
- data/tmp/aruba/testapp/test/test_helper.rb +10 -0
- data/tmp/aruba/testapp/test/unit/user_test.rb +8 -0
- metadata +176 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: d1f9f29f1742f1b31b2490db8c67a9a2c56c5831
|
|
4
|
+
data.tar.gz: 14c46f3211ecfb2cf8eb7642f8f8d11a951b5247
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ac9e794f2ca023d94bb099eddcecaf94d5837b8df1e2e92f6636b853fe114b3d1831b2975085b4dbe2c6350cd7cd720e0250690e5756d46a20afdf37eb1b6e3f
|
|
7
|
+
data.tar.gz: dd92c3b8761ca1a91f948546bf6ad28db4c3e5f4161904ff04b83b52666922752b8bfae0023f5300ee896dfa8fd6944db495e37f8550ef7c55fc635008b91543
|
data/Appraisals
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# These are the versions of Rails we want to test against.
|
|
2
|
+
appraise 'rails3.2' do
|
|
3
|
+
gem 'rails', '~> 3.2.21'
|
|
4
|
+
gem 'sass-rails'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
appraise 'rails4.1' do
|
|
8
|
+
gem 'rails', '~> 4.1.9'
|
|
9
|
+
gem 'sass-rails'
|
|
10
|
+
gem 'spring'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
appraise 'rails4.2' do
|
|
14
|
+
gem 'rails', '~> 4.2.0'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
appraise "rails5.0" do
|
|
18
|
+
gem "activerecord", "~> 5.0.0"
|
|
19
|
+
gem "railties", "~> 5.0.0"
|
|
20
|
+
gem "rspec-rails", "~> 3.5.0.beta4"
|
|
21
|
+
end
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
We love pull requests from everyone. By participating in this project, you
|
|
4
|
+
agree to abide by the thoughtbot [code of conduct].
|
|
5
|
+
|
|
6
|
+
[code of conduct]: https://thoughtbot.com/open-source-code-of-conduct
|
|
7
|
+
|
|
8
|
+
Fork, then clone the repo:
|
|
9
|
+
|
|
10
|
+
git clone git@github.com:your-username/factory_bot_rails.git
|
|
11
|
+
|
|
12
|
+
Set up your machine:
|
|
13
|
+
|
|
14
|
+
./bin/setup
|
|
15
|
+
|
|
16
|
+
Make sure the tests pass:
|
|
17
|
+
|
|
18
|
+
rake
|
|
19
|
+
|
|
20
|
+
Make your change. Add tests for your change. Make the tests pass:
|
|
21
|
+
|
|
22
|
+
rake
|
|
23
|
+
|
|
24
|
+
Push to your fork and [submit a pull request][pr].
|
|
25
|
+
|
|
26
|
+
[pr]: https://github.com/thoughtbot/factory_bot_rails/compare/
|
|
27
|
+
|
|
28
|
+
At this point you're waiting on us. We like to at least comment on pull requests
|
|
29
|
+
within three business days (and, typically, one business day). We may suggest
|
|
30
|
+
some changes or improvements or alternatives.
|
|
31
|
+
|
|
32
|
+
Some things that will increase the chance that your pull request is accepted:
|
|
33
|
+
|
|
34
|
+
* Write tests.
|
|
35
|
+
* Follow our [style guide][style].
|
|
36
|
+
* Write a [good commit message][commit].
|
|
37
|
+
|
|
38
|
+
[style]: https://github.com/thoughtbot/guides/tree/master/style
|
|
39
|
+
[commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
data/Gemfile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gemspec name: 'factory_bot_rails'
|
|
4
|
+
|
|
5
|
+
gem 'appraisal'
|
|
6
|
+
gem 'aruba'
|
|
7
|
+
gem 'coffee-rails'
|
|
8
|
+
gem 'cucumber', '1.3.19'
|
|
9
|
+
gem 'jquery-rails'
|
|
10
|
+
gem 'rake'
|
|
11
|
+
gem 'rspec-rails'
|
|
12
|
+
gem 'uglifier'
|
|
13
|
+
gem 'test-unit'
|
|
14
|
+
|
|
15
|
+
gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
|
|
16
|
+
gem 'jdbc-sqlite3', platforms: :jruby
|
|
17
|
+
gem 'therubyrhino', platforms: :jruby
|
|
18
|
+
gem 'jruby-openssl', platforms: :jruby
|
|
19
|
+
|
|
20
|
+
gem 'sqlite3', platforms: :ruby
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
factory_bot_rails (1.0.0)
|
|
5
|
+
factory_bot (~> 1.0.0)
|
|
6
|
+
railties (>= 3.0.0)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
actionpack (4.1.1)
|
|
12
|
+
actionview (= 4.1.1)
|
|
13
|
+
activesupport (= 4.1.1)
|
|
14
|
+
rack (~> 1.5.2)
|
|
15
|
+
rack-test (~> 0.6.2)
|
|
16
|
+
actionview (4.1.1)
|
|
17
|
+
activesupport (= 4.1.1)
|
|
18
|
+
builder (~> 3.1)
|
|
19
|
+
erubis (~> 2.7.0)
|
|
20
|
+
activemodel (4.1.1)
|
|
21
|
+
activesupport (= 4.1.1)
|
|
22
|
+
builder (~> 3.1)
|
|
23
|
+
activerecord (4.1.1)
|
|
24
|
+
activemodel (= 4.1.1)
|
|
25
|
+
activesupport (= 4.1.1)
|
|
26
|
+
arel (~> 5.0.0)
|
|
27
|
+
activerecord-jdbc-adapter (1.3.15)
|
|
28
|
+
activerecord (>= 2.2)
|
|
29
|
+
activerecord-jdbcsqlite3-adapter (1.3.15)
|
|
30
|
+
activerecord-jdbc-adapter (~> 1.3.15)
|
|
31
|
+
jdbc-sqlite3 (>= 3.7.2, < 3.9)
|
|
32
|
+
activesupport (4.1.1)
|
|
33
|
+
i18n (~> 0.6, >= 0.6.9)
|
|
34
|
+
json (~> 1.7, >= 1.7.7)
|
|
35
|
+
minitest (~> 5.1)
|
|
36
|
+
thread_safe (~> 0.1)
|
|
37
|
+
tzinfo (~> 1.1)
|
|
38
|
+
appraisal (1.0.3)
|
|
39
|
+
bundler
|
|
40
|
+
rake
|
|
41
|
+
thor (>= 0.14.0)
|
|
42
|
+
arel (5.0.1.20140414130214)
|
|
43
|
+
aruba (0.5.4)
|
|
44
|
+
childprocess (>= 0.3.6)
|
|
45
|
+
cucumber (>= 1.1.1)
|
|
46
|
+
rspec-expectations (>= 2.7.0)
|
|
47
|
+
builder (3.2.2)
|
|
48
|
+
childprocess (0.5.3)
|
|
49
|
+
ffi (~> 1.0, >= 1.0.11)
|
|
50
|
+
coffee-rails (4.0.1)
|
|
51
|
+
coffee-script (>= 2.2.0)
|
|
52
|
+
railties (>= 4.0.0, < 5.0)
|
|
53
|
+
coffee-script (2.2.0)
|
|
54
|
+
coffee-script-source
|
|
55
|
+
execjs
|
|
56
|
+
coffee-script-source (1.7.0)
|
|
57
|
+
cucumber (1.3.19)
|
|
58
|
+
builder (>= 2.1.2)
|
|
59
|
+
diff-lcs (>= 1.1.3)
|
|
60
|
+
gherkin (~> 2.12)
|
|
61
|
+
multi_json (>= 1.7.5, < 2.0)
|
|
62
|
+
multi_test (>= 0.1.2)
|
|
63
|
+
diff-lcs (1.2.5)
|
|
64
|
+
erubis (2.7.0)
|
|
65
|
+
execjs (2.0.2)
|
|
66
|
+
factory_bot (1.0.0)
|
|
67
|
+
activesupport (>= 3.0.0)
|
|
68
|
+
ffi (1.9.3)
|
|
69
|
+
ffi (1.9.3-java)
|
|
70
|
+
gherkin (2.12.2)
|
|
71
|
+
multi_json (~> 1.3)
|
|
72
|
+
gherkin (2.12.2-java)
|
|
73
|
+
multi_json (~> 1.3)
|
|
74
|
+
i18n (0.7.0)
|
|
75
|
+
jdbc-sqlite3 (3.8.7)
|
|
76
|
+
jquery-rails (3.1.0)
|
|
77
|
+
railties (>= 3.0, < 5.0)
|
|
78
|
+
thor (>= 0.14, < 2.0)
|
|
79
|
+
jruby-openssl (0.9.6-java)
|
|
80
|
+
json (1.8.3)
|
|
81
|
+
json (1.8.3-java)
|
|
82
|
+
minitest (5.9.0)
|
|
83
|
+
multi_json (1.11.2)
|
|
84
|
+
multi_test (0.1.2)
|
|
85
|
+
power_assert (0.2.3)
|
|
86
|
+
rack (1.5.5)
|
|
87
|
+
rack-test (0.6.3)
|
|
88
|
+
rack (>= 1.0)
|
|
89
|
+
railties (4.1.1)
|
|
90
|
+
actionpack (= 4.1.1)
|
|
91
|
+
activesupport (= 4.1.1)
|
|
92
|
+
rake (>= 0.8.7)
|
|
93
|
+
thor (>= 0.18.1, < 2.0)
|
|
94
|
+
rake (11.1.2)
|
|
95
|
+
rspec-core (2.14.8)
|
|
96
|
+
rspec-expectations (2.14.5)
|
|
97
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
98
|
+
rspec-mocks (2.14.6)
|
|
99
|
+
rspec-rails (2.14.2)
|
|
100
|
+
actionpack (>= 3.0)
|
|
101
|
+
activemodel (>= 3.0)
|
|
102
|
+
activesupport (>= 3.0)
|
|
103
|
+
railties (>= 3.0)
|
|
104
|
+
rspec-core (~> 2.14.0)
|
|
105
|
+
rspec-expectations (~> 2.14.0)
|
|
106
|
+
rspec-mocks (~> 2.14.0)
|
|
107
|
+
sqlite3 (1.3.9)
|
|
108
|
+
test-unit (3.0.9)
|
|
109
|
+
power_assert
|
|
110
|
+
therubyrhino (2.0.4)
|
|
111
|
+
therubyrhino_jar (>= 1.7.3)
|
|
112
|
+
therubyrhino_jar (1.7.4)
|
|
113
|
+
thor (0.19.1)
|
|
114
|
+
thread_safe (0.3.5)
|
|
115
|
+
thread_safe (0.3.5-java)
|
|
116
|
+
tzinfo (1.2.2)
|
|
117
|
+
thread_safe (~> 0.1)
|
|
118
|
+
uglifier (2.5.0)
|
|
119
|
+
execjs (>= 0.3.0)
|
|
120
|
+
json (>= 1.8.0)
|
|
121
|
+
|
|
122
|
+
PLATFORMS
|
|
123
|
+
java
|
|
124
|
+
ruby
|
|
125
|
+
|
|
126
|
+
DEPENDENCIES
|
|
127
|
+
activerecord-jdbcsqlite3-adapter
|
|
128
|
+
appraisal
|
|
129
|
+
aruba
|
|
130
|
+
coffee-rails
|
|
131
|
+
cucumber (= 1.3.19)
|
|
132
|
+
factory_bot_rails!
|
|
133
|
+
jdbc-sqlite3
|
|
134
|
+
jquery-rails
|
|
135
|
+
jruby-openssl
|
|
136
|
+
rake
|
|
137
|
+
rspec-rails
|
|
138
|
+
sqlite3
|
|
139
|
+
test-unit
|
|
140
|
+
therubyrhino
|
|
141
|
+
uglifier
|
|
142
|
+
|
|
143
|
+
BUNDLED WITH
|
|
144
|
+
1.13.6
|
data/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2008-2013 Joe Ferris and thoughtbot, inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
data/NEWS
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
factory_girl_rails versioning is synced with factory_girl releases. For this reason
|
|
2
|
+
there might not be any notable changes in new versions of this project.
|
|
3
|
+
|
|
4
|
+
4.7.0 (April 1, 2016)
|
|
5
|
+
No notable changes
|
|
6
|
+
|
|
7
|
+
4.6.0 (February 1, 2016)
|
|
8
|
+
No notable changes
|
|
9
|
+
|
|
10
|
+
4.5.0 (October 17, 2014)
|
|
11
|
+
Improved README
|
|
12
|
+
|
|
13
|
+
4.4.1 (February 26, 2014)
|
|
14
|
+
Support Spring
|
|
15
|
+
|
|
16
|
+
4.2.1 (February 8, 2013)
|
|
17
|
+
Fix bug when configuring FG and RSpec fixture directory
|
|
18
|
+
Remove debugging
|
|
19
|
+
Require factory_girl_rails explicitly in generator
|
|
20
|
+
|
|
21
|
+
4.2.0 (January 25, 2013)
|
|
22
|
+
Add appraisal and get test suite working reliably with turn gem
|
|
23
|
+
Support MiniTest
|
|
24
|
+
Allow a custom directory for factories to be specified
|
data/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# factory_bot_rails [![Build Status][ci-image]][ci] [![Code Climate][grade-image]][grade]
|
|
2
|
+
|
|
3
|
+
[factory_bot][fb] is a fixtures replacement with a straightforward definition
|
|
4
|
+
syntax, support for multiple build strategies (saved instances, unsaved
|
|
5
|
+
instances, attribute hashes, and stubbed objects), and support for multiple
|
|
6
|
+
factories for the same class (`user`, `admin_user`, and so on), including factory
|
|
7
|
+
inheritance.
|
|
8
|
+
|
|
9
|
+
## Rails
|
|
10
|
+
|
|
11
|
+
factory_bot_rails provides Rails integration for [factory_bot][fb].
|
|
12
|
+
|
|
13
|
+
Currently, automatic factory definition loading is the only Rails-specific feature.
|
|
14
|
+
|
|
15
|
+
Supported Rails versions are listed in [`Appraisals`](Appraisals). Supported
|
|
16
|
+
Ruby versions are listed in [`.travis.yml`](.travis.yml).
|
|
17
|
+
|
|
18
|
+
## Download
|
|
19
|
+
|
|
20
|
+
Github: http://github.com/thoughtbot/factory_bot_rails
|
|
21
|
+
|
|
22
|
+
Gem:
|
|
23
|
+
|
|
24
|
+
$ gem install factory_bot_rails
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
Add `factory_bot_rails` to your Gemfile:
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
group :development, :test do
|
|
32
|
+
gem 'factory_bot_rails'
|
|
33
|
+
end
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Generators for factories will automatically substitute fixture (and maybe any other
|
|
37
|
+
`fixture_replacement` you set). If you want to disable this feature, add the
|
|
38
|
+
following to your application.rb file:
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
config.generators do |g|
|
|
42
|
+
g.factory_bot false
|
|
43
|
+
end
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Default factories directory is `test/factories`, or `spec/factories` if
|
|
47
|
+
`test_framework` generator is set to `:rspec`; change this behavior with:
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
config.generators do |g|
|
|
51
|
+
g.factory_bot dir: 'custom/dir/for/factories'
|
|
52
|
+
end
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If you use factory_bot for fixture replacement, ensure that
|
|
56
|
+
factory_bot_rails is available in the development group. If it's not, Rails
|
|
57
|
+
will generate standard .yml files instead of factory files.
|
|
58
|
+
|
|
59
|
+
factory_bot takes an option `suffix: 'some_suffix'` to generate factories as
|
|
60
|
+
`modelname_some_suffix.rb`.
|
|
61
|
+
|
|
62
|
+
If you use factory_bot for fixture replacement and already have a
|
|
63
|
+
`factories.rb` file in the directory that contains your tests,
|
|
64
|
+
factory_bot_rails will insert new factory definitions at the top of
|
|
65
|
+
`factories.rb`.
|
|
66
|
+
|
|
67
|
+
You may need to configure your test suite to include factory_bot methods; see
|
|
68
|
+
[configuration](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#configure-your-test-suite).
|
|
69
|
+
|
|
70
|
+
## Contributing
|
|
71
|
+
|
|
72
|
+
Please see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
73
|
+
|
|
74
|
+
## Credits
|
|
75
|
+
|
|
76
|
+
[factory_bot][fb] was originally written by Joe Ferris.
|
|
77
|
+
|
|
78
|
+

|
|
79
|
+
|
|
80
|
+
factory_bot is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
|
|
81
|
+
|
|
82
|
+
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
factory_bot_rails is Copyright © 2008-2016 Joe Ferris and thoughtbot. It is free
|
|
87
|
+
software, and may be redistributed under the terms specified in the
|
|
88
|
+
[LICENSE](LICENSE) file.
|
|
89
|
+
|
|
90
|
+
[fb]: https://github.com/thoughtbot/factory_bot
|
|
91
|
+
[ci]: http://travis-ci.org/thoughtbot/factory_bot_rails?branch=master
|
|
92
|
+
[ci-image]: https://secure.travis-ci.org/thoughtbot/factory_bot_rails.png
|
|
93
|
+
[grade]: https://codeclimate.com/github/thoughtbot/factory_bot_rails
|
|
94
|
+
[grade-image]: https://codeclimate.com/github/thoughtbot/factory_bot_rails.png
|
data/Rakefile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'bundler/setup'
|
|
2
|
+
require 'cucumber/rake/task'
|
|
3
|
+
|
|
4
|
+
Bundler::GemHelper.install_tasks name: 'factory_bot_rails'
|
|
5
|
+
|
|
6
|
+
Cucumber::Rake::Task.new(:cucumber) do |t|
|
|
7
|
+
t.fork = true
|
|
8
|
+
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
require 'appraisal'
|
|
12
|
+
|
|
13
|
+
desc 'Run the test suite'
|
|
14
|
+
task :default do |t|
|
|
15
|
+
if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
|
|
16
|
+
exec 'rake cucumber'
|
|
17
|
+
else
|
|
18
|
+
Rake::Task['appraise'].execute
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
task :appraise => ['appraisal:install'] do |t|
|
|
23
|
+
exec 'rake appraisal'
|
|
24
|
+
end
|
data/bin/setup
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# Run this script immediately after cloning the codebase.
|
|
4
|
+
|
|
5
|
+
# Exit if any subcommand fails
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# Set up Ruby dependencies via Bundler
|
|
9
|
+
bundle install
|
|
10
|
+
|
|
11
|
+
# Add binstubs to PATH in ~/.zshenv like this:
|
|
12
|
+
# export PATH=".git/safe/../../bin:$PATH"
|
|
13
|
+
mkdir -p .git/safe
|
|
14
|
+
|
|
15
|
+
# Set up Appraisal to help us test against multiple Rails versions
|
|
16
|
+
bundle exec appraisal install
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = %q{factory_bot_rails}
|
|
3
|
+
s.version = '1.0.0.alpha'
|
|
4
|
+
s.authors = ["Joe Ferris"]
|
|
5
|
+
s.email = %q{jferris@thoughtbot.com}
|
|
6
|
+
s.homepage = "http://github.com/thoughtbot/factory_bot_rails"
|
|
7
|
+
s.summary = %q{factory_bot_rails provides integration between
|
|
8
|
+
factory_bot and rails 3 or newer}
|
|
9
|
+
s.description = %q{factory_bot_rails provides integration between
|
|
10
|
+
factory_bot and rails 3 or newer (currently just automatic factory definition
|
|
11
|
+
loading)}
|
|
12
|
+
|
|
13
|
+
s.files = Dir['**/*'].keep_if { |file| File.file?(file) }
|
|
14
|
+
s.require_paths = ["lib"]
|
|
15
|
+
s.executables = []
|
|
16
|
+
s.license = "MIT"
|
|
17
|
+
|
|
18
|
+
s.add_runtime_dependency('railties', '>= 3.0.0')
|
|
19
|
+
s.add_runtime_dependency('factory_bot', '~> 1.0.0.alpha')
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = %q{factory_girl_rails}
|
|
3
|
+
s.version = '4.8.1'
|
|
4
|
+
s.authors = ["Joe Ferris"]
|
|
5
|
+
s.email = %q{jferris@thoughtbot.com}
|
|
6
|
+
s.homepage = "http://github.com/thoughtbot/factory_girl_rails"
|
|
7
|
+
s.summary = %q{factory_girl_rails provides integration between
|
|
8
|
+
factory_girl and rails 3 or newer}
|
|
9
|
+
s.description = %q{factory_girl_rails provides integration between
|
|
10
|
+
factory_girl and rails 3 or newer (currently just automatic factory definition
|
|
11
|
+
loading)}
|
|
12
|
+
|
|
13
|
+
s.files = Dir['**/*'].keep_if { |file| File.file?(file) }
|
|
14
|
+
s.require_paths = ["lib"]
|
|
15
|
+
s.executables = []
|
|
16
|
+
s.license = "MIT"
|
|
17
|
+
|
|
18
|
+
s.add_runtime_dependency('railties', '>= 3.0.0')
|
|
19
|
+
s.add_runtime_dependency('factory_girl', '~> 4.8.1')
|
|
20
|
+
end
|