factory_girl_rails 4.4.1 → 4.5.0
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/.gitignore +6 -6
- data/.travis.yml +11 -7
- data/Appraisals +13 -22
- data/CONTRIBUTING.md +24 -26
- data/Gemfile +18 -1
- data/Gemfile.lock +112 -0
- data/README.md +46 -38
- data/bin/setup +16 -0
- data/factory_girl_rails.gemspec +3 -9
- data/features/fixture_replacement_config.feature +19 -11
- data/features/generators.feature +12 -12
- data/features/load_definitions.feature +3 -4
- data/features/step_definitions/appraisal.rb +1 -1
- data/features/step_definitions/rails_steps.rb +8 -13
- data/gemfiles/rails3.2.gemfile +9 -8
- data/gemfiles/rails4.0.gemfile +17 -0
- data/gemfiles/rails4.1.gemfile +18 -0
- data/lib/factory_girl_rails/generators/rspec_generator.rb +1 -1
- data/lib/generators/factory_girl/model/model_generator.rb +62 -8
- metadata +12 -85
- data/gemfiles/rails3.1.gemfile +0 -16
- data/gemfiles/rails3.1.gemfile.lock +0 -171
- data/gemfiles/rails3.2.gemfile.lock +0 -169
- data/lib/generators/factory_girl/model/templates/fixtures.erb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 501700716b0d0a25dc9aeb99c35b1f85964bde77
|
4
|
+
data.tar.gz: 5b07b7d3b1f472f8ea85d1ea63ad9dd0d91a232c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4261217f6d01aabccf3de6f61fd613434cf9c3694d2f6d4ed5a9f321890857644fb268bb32542a903091003b18373020e58e8f2d48a760bf110c659904b35bc1
|
7
|
+
data.tar.gz: 36c64ec1a1a9f3fc079fa925a8155b0872d17ddf9fedf4e937baae457d2b7ccf98fd3eeb0b6bf06b0acf9b77d5ba9471fa6548e1900d321040b04164450788da
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,16 +1,20 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
1
3
|
rvm:
|
2
4
|
- 1.9.3
|
3
5
|
- 2.0.0
|
6
|
+
- 2.1.2
|
4
7
|
- jruby-19mode
|
5
|
-
before_install:
|
6
|
-
- gem update --system
|
7
|
-
- gem install turn --version 0.8.2
|
8
|
-
- gem install turn --version 0.8.3
|
9
8
|
jdk:
|
10
9
|
- openjdk6
|
11
|
-
gemfile:
|
12
|
-
- gemfiles/rails3.1.gemfile
|
13
|
-
- gemfiles/rails3.2.gemfile
|
14
10
|
branches:
|
15
11
|
only:
|
16
12
|
- master
|
13
|
+
install:
|
14
|
+
- "travis_retry bundle install"
|
15
|
+
- "bundle exec appraisal generate"
|
16
|
+
- "travis_retry bundle exec appraisal install"
|
17
|
+
gemfile:
|
18
|
+
- gemfiles/rails3.2.gemfile
|
19
|
+
- gemfiles/rails4.0.gemfile
|
20
|
+
- gemfiles/rails4.1.gemfile
|
data/Appraisals
CHANGED
@@ -1,25 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
gem
|
4
|
-
gem
|
5
|
-
gem "uglifier"
|
6
|
-
gem "sqlite3", ">= 1.3.4", platforms: :mri
|
7
|
-
gem "activerecord-jdbcsqlite3-adapter", "~> 1.2.5", platforms: :jruby
|
8
|
-
gem "minitest-rails"
|
9
|
-
gem "therubyrhino"
|
10
|
-
gem "jquery-rails"
|
11
|
-
gem "rspec-rails"
|
1
|
+
# These are the versions of Rails we want to test against.
|
2
|
+
appraise 'rails3.2' do
|
3
|
+
gem 'rails', '~> 3.2.18'
|
4
|
+
gem 'sass-rails'
|
12
5
|
end
|
13
6
|
|
14
|
-
appraise
|
15
|
-
gem
|
16
|
-
gem
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
gem
|
21
|
-
gem
|
22
|
-
gem
|
23
|
-
gem "jquery-rails"
|
24
|
-
gem "rspec-rails"
|
7
|
+
appraise 'rails4.0' do
|
8
|
+
gem 'rails', '~> 4.0.5'
|
9
|
+
gem 'sass-rails'
|
10
|
+
end
|
11
|
+
|
12
|
+
appraise 'rails4.1' do
|
13
|
+
gem 'rails', '~> 4.1.1'
|
14
|
+
gem 'sass-rails', '~> 4.0.3'
|
15
|
+
gem 'spring'
|
25
16
|
end
|
data/CONTRIBUTING.md
CHANGED
@@ -1,38 +1,36 @@
|
|
1
|
-
|
1
|
+
# Contributing
|
2
2
|
|
3
|
-
|
3
|
+
We love pull requests. Here's a quick guide.
|
4
4
|
|
5
|
-
|
6
|
-
to know that you have a clean slate: `bundle && rake`
|
5
|
+
Fork, then clone the repo:
|
7
6
|
|
8
|
-
|
9
|
-
require no new tests. If you are adding functionality or fixing a bug, we need
|
10
|
-
a test!
|
7
|
+
git clone git@github.com:your-username/factory_girl_rails.git
|
11
8
|
|
12
|
-
|
9
|
+
Set up your machine:
|
13
10
|
|
14
|
-
|
11
|
+
./bin/setup
|
15
12
|
|
13
|
+
Make sure the tests pass:
|
16
14
|
|
17
|
-
|
18
|
-
accept, pull requests within three business days (and, typically, one business
|
19
|
-
day). We may suggest some changes or improvements or alternatives.
|
15
|
+
rake
|
20
16
|
|
21
|
-
|
22
|
-
taken straight from the Ruby on Rails guide:
|
17
|
+
Make your change. Add tests for your change. Make the tests pass:
|
23
18
|
|
24
|
-
|
25
|
-
* Include tests that fail without your code, and pass with it
|
26
|
-
* Update the documentation, the surrounding one, examples elsewhere, guides,
|
27
|
-
whatever is affected by your contribution
|
19
|
+
rake
|
28
20
|
|
29
|
-
|
21
|
+
Push to your fork and [submit a pull request][pr].
|
30
22
|
|
31
|
-
|
32
|
-
* No trailing whitespace. Blank lines should not have any space.
|
33
|
-
* Prefer &&/|| over and/or.
|
34
|
-
* MyClass.my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
35
|
-
* a = b and not a=b.
|
36
|
-
* Follow the conventions you see used in the source already.
|
23
|
+
[pr]: https://github.com/thoughtbot/factory_girl_rails/compare/
|
37
24
|
|
38
|
-
|
25
|
+
At this point you're waiting on us. We like to at least comment on pull requests
|
26
|
+
within three business days (and, typically, one business day). We may suggest
|
27
|
+
some changes or improvements or alternatives.
|
28
|
+
|
29
|
+
Some things that will increase the chance that your pull request is accepted:
|
30
|
+
|
31
|
+
* Write tests.
|
32
|
+
* Follow our [style guide][style].
|
33
|
+
* Write a [good commit message][commit].
|
34
|
+
|
35
|
+
[style]: https://github.com/thoughtbot/guides/tree/master/style
|
36
|
+
[commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
data/Gemfile
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec
|
4
|
+
|
5
|
+
gem 'appraisal'
|
6
|
+
gem 'aruba'
|
7
|
+
gem 'coffee-rails'
|
8
|
+
gem 'cucumber'
|
9
|
+
gem 'jquery-rails'
|
10
|
+
gem 'rake'
|
11
|
+
gem 'rspec-rails'
|
12
|
+
gem 'uglifier'
|
13
|
+
|
14
|
+
if RUBY_PLATFORM == 'java'
|
15
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
16
|
+
gem 'jdbc-sqlite3'
|
17
|
+
gem 'therubyrhino'
|
18
|
+
else
|
19
|
+
gem 'sqlite3'
|
20
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
factory_girl_rails (4.5.0)
|
5
|
+
factory_girl (~> 4.5.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
|
+
activesupport (4.1.1)
|
24
|
+
i18n (~> 0.6, >= 0.6.9)
|
25
|
+
json (~> 1.7, >= 1.7.7)
|
26
|
+
minitest (~> 5.1)
|
27
|
+
thread_safe (~> 0.1)
|
28
|
+
tzinfo (~> 1.1)
|
29
|
+
appraisal (1.0.0)
|
30
|
+
bundler
|
31
|
+
rake
|
32
|
+
thor (>= 0.14.0)
|
33
|
+
aruba (0.5.4)
|
34
|
+
childprocess (>= 0.3.6)
|
35
|
+
cucumber (>= 1.1.1)
|
36
|
+
rspec-expectations (>= 2.7.0)
|
37
|
+
builder (3.2.2)
|
38
|
+
childprocess (0.5.3)
|
39
|
+
ffi (~> 1.0, >= 1.0.11)
|
40
|
+
coffee-rails (4.0.1)
|
41
|
+
coffee-script (>= 2.2.0)
|
42
|
+
railties (>= 4.0.0, < 5.0)
|
43
|
+
coffee-script (2.2.0)
|
44
|
+
coffee-script-source
|
45
|
+
execjs
|
46
|
+
coffee-script-source (1.7.0)
|
47
|
+
cucumber (1.3.15)
|
48
|
+
builder (>= 2.1.2)
|
49
|
+
diff-lcs (>= 1.1.3)
|
50
|
+
gherkin (~> 2.12)
|
51
|
+
multi_json (>= 1.7.5, < 2.0)
|
52
|
+
multi_test (>= 0.1.1)
|
53
|
+
diff-lcs (1.2.5)
|
54
|
+
erubis (2.7.0)
|
55
|
+
execjs (2.0.2)
|
56
|
+
factory_girl (4.5.0)
|
57
|
+
activesupport (>= 3.0.0)
|
58
|
+
ffi (1.9.3)
|
59
|
+
gherkin (2.12.2)
|
60
|
+
multi_json (~> 1.3)
|
61
|
+
i18n (0.6.9)
|
62
|
+
jquery-rails (3.1.0)
|
63
|
+
railties (>= 3.0, < 5.0)
|
64
|
+
thor (>= 0.14, < 2.0)
|
65
|
+
json (1.8.1)
|
66
|
+
minitest (5.3.4)
|
67
|
+
multi_json (1.10.1)
|
68
|
+
multi_test (0.1.1)
|
69
|
+
rack (1.5.2)
|
70
|
+
rack-test (0.6.2)
|
71
|
+
rack (>= 1.0)
|
72
|
+
railties (4.1.1)
|
73
|
+
actionpack (= 4.1.1)
|
74
|
+
activesupport (= 4.1.1)
|
75
|
+
rake (>= 0.8.7)
|
76
|
+
thor (>= 0.18.1, < 2.0)
|
77
|
+
rake (10.3.2)
|
78
|
+
rspec-core (2.14.8)
|
79
|
+
rspec-expectations (2.14.5)
|
80
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
81
|
+
rspec-mocks (2.14.6)
|
82
|
+
rspec-rails (2.14.2)
|
83
|
+
actionpack (>= 3.0)
|
84
|
+
activemodel (>= 3.0)
|
85
|
+
activesupport (>= 3.0)
|
86
|
+
railties (>= 3.0)
|
87
|
+
rspec-core (~> 2.14.0)
|
88
|
+
rspec-expectations (~> 2.14.0)
|
89
|
+
rspec-mocks (~> 2.14.0)
|
90
|
+
sqlite3 (1.3.9)
|
91
|
+
thor (0.19.1)
|
92
|
+
thread_safe (0.3.3)
|
93
|
+
tzinfo (1.2.0)
|
94
|
+
thread_safe (~> 0.1)
|
95
|
+
uglifier (2.5.0)
|
96
|
+
execjs (>= 0.3.0)
|
97
|
+
json (>= 1.8.0)
|
98
|
+
|
99
|
+
PLATFORMS
|
100
|
+
ruby
|
101
|
+
|
102
|
+
DEPENDENCIES
|
103
|
+
appraisal
|
104
|
+
aruba
|
105
|
+
coffee-rails
|
106
|
+
cucumber
|
107
|
+
factory_girl_rails!
|
108
|
+
jquery-rails
|
109
|
+
rake
|
110
|
+
rspec-rails
|
111
|
+
sqlite3
|
112
|
+
uglifier
|
data/README.md
CHANGED
@@ -1,73 +1,74 @@
|
|
1
|
-
|
2
|
-
============
|
1
|
+
# factory_girl_rails [![Build Status][ci-image]][ci] [![Code Climate][grade-image]][grade]
|
3
2
|
|
4
|
-
|
3
|
+
[factory_girl][fg] is a fixtures replacement with a straightforward definition
|
5
4
|
syntax, support for multiple build strategies (saved instances, unsaved
|
6
5
|
instances, attribute hashes, and stubbed objects), and support for multiple
|
7
6
|
factories for the same class (`user`, `admin_user`, and so on), including factory
|
8
7
|
inheritance.
|
9
8
|
|
10
|
-
Rails
|
11
|
-
-----
|
9
|
+
## Rails
|
12
10
|
|
13
|
-
|
14
|
-
Rails-specific features are only compatible with Rails 3.
|
11
|
+
factory_girl_rails provides Rails integration for [factory_girl][fg].
|
15
12
|
|
16
13
|
Currently, automatic factory definition loading is the only Rails-specific feature.
|
17
14
|
|
18
|
-
|
19
|
-
|
15
|
+
Supported Rails versions are listed in [`Appraisals`](Appraisals). Supported
|
16
|
+
Ruby versions are listed in [`.travis.yml`](.travis.yml).
|
20
17
|
|
21
|
-
|
18
|
+
## Download
|
19
|
+
|
20
|
+
Github: http://github.com/thoughtbot/factory_girl_rails
|
22
21
|
|
23
22
|
Gem:
|
24
23
|
|
25
24
|
gem install factory_girl_rails
|
26
25
|
|
27
|
-
Configuration
|
28
|
-
-------------
|
26
|
+
## Configuration
|
29
27
|
|
30
28
|
Add `factory_girl_rails` to your Gemfile:
|
31
29
|
|
32
|
-
|
30
|
+
```ruby
|
31
|
+
gem 'factory_girl_rails'
|
32
|
+
```
|
33
33
|
|
34
34
|
Generators for factories will automatically substitute fixture (and maybe any other
|
35
35
|
`fixture_replacement` you set). If you want to disable this feature, add the
|
36
36
|
following to your application.rb file:
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
```ruby
|
39
|
+
config.generators do |g|
|
40
|
+
g.factory_girl false
|
41
|
+
end
|
42
|
+
```
|
41
43
|
|
42
44
|
Default factories directory is `test/factories`, or `spec/factories` if
|
43
45
|
`test_framework` generator is set to `:rspec`; change this behavior with:
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
`factory_girl_rails` is available in the development group. If it's not, Rails
|
51
|
-
will generate standard yml files instead of factory files.
|
47
|
+
```ruby
|
48
|
+
config.generators do |g|
|
49
|
+
g.factory_girl dir: 'custom/dir/for/factories'
|
50
|
+
end
|
51
|
+
```
|
52
52
|
|
53
|
-
|
54
|
-
|
53
|
+
If you use factory_girl for fixture replacement, ensure that
|
54
|
+
factory_girl_rails is available in the development group. If it's not, Rails
|
55
|
+
will generate standard .yml files instead of factory files.
|
55
56
|
|
56
|
-
|
57
|
-
|
57
|
+
factory_girl takes an option `suffix: 'some_suffix'` to generate factories as
|
58
|
+
`modelname_some_suffix.rb`.
|
58
59
|
|
59
|
-
factory_girl
|
60
|
+
If you use factory_girl for fixture replacement and already have a
|
61
|
+
`factories.rb` file in the directory that contains your tests,
|
62
|
+
factory_girl_rails will insert new factory definitions at the top of
|
63
|
+
`factories.rb`.
|
60
64
|
|
65
|
+
## Contributing
|
61
66
|
|
62
|
-
|
63
|
-
------------
|
67
|
+
Please see [CONTRIBUTING.md](CONTRIBUTING.md).
|
64
68
|
|
65
|
-
|
69
|
+
## Credits
|
66
70
|
|
67
|
-
|
68
|
-
-------
|
69
|
-
|
70
|
-
factory_girl was originally written by Joe Ferris.
|
71
|
+
[factory_girl][fg] was originally written by Joe Ferris.
|
71
72
|
|
72
73
|

|
73
74
|
|
@@ -75,7 +76,14 @@ factory_girl is maintained and funded by [thoughtbot, inc](http://thoughtbot.com
|
|
75
76
|
|
76
77
|
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
77
78
|
|
78
|
-
License
|
79
|
-
|
79
|
+
## License
|
80
|
+
|
81
|
+
factory_girl_rails is Copyright © 2008-2014 Joe Ferris and thoughtbot. It is free
|
82
|
+
software, and may be redistributed under the terms specified in the
|
83
|
+
[LICENSE]() file.
|
80
84
|
|
81
|
-
|
85
|
+
[fg]: https://github.com/thoughtbot/factory_girl
|
86
|
+
[ci]: http://travis-ci.org/thoughtbot/factory_girl_rails?branch=master
|
87
|
+
[ci-image]: https://secure.travis-ci.org/thoughtbot/factory_girl_rails.png
|
88
|
+
[grade]: https://codeclimate.com/github/thoughtbot/factory_girl_rails
|
89
|
+
[grade-image]: https://codeclimate.com/github/thoughtbot/factory_girl_rails.png
|
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
|
data/factory_girl_rails.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{factory_girl_rails}
|
3
|
-
s.version = '4.
|
3
|
+
s.version = '4.5.0'
|
4
4
|
s.authors = ["Joe Ferris"]
|
5
5
|
s.email = %q{jferris@thoughtbot.com}
|
6
6
|
s.homepage = "http://github.com/thoughtbot/factory_girl_rails"
|
@@ -11,17 +11,11 @@ Gem::Specification.new do |s|
|
|
11
11
|
loading)}
|
12
12
|
|
13
13
|
s.files = `git ls-files`.split("\n")
|
14
|
-
s.test_files = `git ls-files --
|
14
|
+
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
15
15
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.license = "MIT"
|
18
18
|
|
19
19
|
s.add_runtime_dependency('railties', '>= 3.0.0')
|
20
|
-
s.add_runtime_dependency('factory_girl', '~> 4.
|
21
|
-
|
22
|
-
s.add_development_dependency('appraisal', '~> 0.5.0')
|
23
|
-
s.add_development_dependency('rake')
|
24
|
-
s.add_development_dependency('rspec', '~> 2.11.0')
|
25
|
-
s.add_development_dependency('cucumber', '~> 1.2.1')
|
26
|
-
s.add_development_dependency('aruba', '~> 0.5.1')
|
20
|
+
s.add_runtime_dependency('factory_girl', '~> 4.5.0')
|
27
21
|
end
|