challah 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -2
- data/README.md +18 -18
- data/lib/challah/test.rb +22 -5
- data/lib/challah/version.rb +1 -1
- data/test/audit_test.rb +32 -32
- data/test/controller_test.rb +9 -9
- data/test/cookie_store_test.rb +25 -25
- data/test/factories.rb +7 -7
- data/test/helper.rb +14 -12
- data/test/permission_test.rb +14 -14
- data/test/restrictions_controller_test.rb +29 -30
- data/test/role_test.rb +26 -26
- data/test/session_test.rb +65 -65
- data/test/sessions_controller_test.rb +13 -13
- data/test/simple_cookie_store_test.rb +25 -25
- data/test/user_test.rb +79 -79
- data/vendor/bundle/cache/factory_girl-3.0.0.gem +0 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/Appraisals +11 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/CONTRIBUTION_GUIDELINES.md +10 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/Changelog +168 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/GETTING_STARTED.md +735 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/Gemfile +5 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/Gemfile.lock +95 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/LICENSE +19 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/README.md +70 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/Rakefile +38 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/cucumber.yml +1 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/factory_girl.gemspec +38 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/features/factory_girl_steps.feature +237 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/features/find_definitions.feature +75 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/features/step_definitions/database_steps.rb +42 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/features/step_definitions/factory_girl_steps.rb +43 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/features/support/env.rb +11 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/features/support/factories.rb +119 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/gemfiles/2.3.gemfile +7 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/gemfiles/3.0.gemfile +7 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/gemfiles/3.0.gemfile.lock +86 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/gemfiles/3.1.gemfile +7 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/gemfiles/3.1.gemfile.lock +95 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/gemfiles/3.2.gemfile +7 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/gemfiles/3.2.gemfile.lock +93 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl.rb +69 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/aliases.rb +19 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/attribute.rb +40 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/attribute/association.rb +23 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/attribute/dynamic.rb +20 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/attribute/sequence.rb +17 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/attribute/static.rb +15 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/attribute_assigner.rb +73 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/attribute_list.rb +54 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/callback.rb +33 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/declaration.rb +22 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/declaration/association.rb +25 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/declaration/dynamic.rb +25 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/declaration/implicit.rb +32 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/declaration/static.rb +25 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/declaration_list.rb +48 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/definition.rb +76 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/definition_proxy.rb +159 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/errors.rb +19 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/evaluator.rb +76 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/evaluator_class_definer.rb +34 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/factory.rb +145 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/factory_runner.rb +24 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/find_definitions.rb +25 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/null_factory.rb +15 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/null_object.rb +7 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/registry.rb +46 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/reload.rb +8 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/sequence.rb +24 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/step_definitions.rb +130 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb +32 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy/attributes_for.rb +12 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy/build.rb +15 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy/create.rb +17 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy/stub.rb +61 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy_calculator.rb +29 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/syntax.rb +16 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/syntax/blueprint.rb +42 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/syntax/default.rb +56 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/syntax/generate.rb +70 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/syntax/make.rb +45 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/syntax/methods.rb +136 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/syntax/sham.rb +45 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/syntax/vintage.rb +130 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/trait.rb +29 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/version.rb +4 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/aliases_spec.rb +19 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/attribute_aliases_spec.rb +45 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/attribute_existing_on_object_spec.rb +68 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/attributes_for_spec.rb +89 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/attributes_from_instance_spec.rb +53 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/attributes_ordered_spec.rb +51 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/build_list_spec.rb +41 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/build_spec.rb +89 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/build_stubbed_spec.rb +104 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/callbacks_spec.rb +47 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/create_list_spec.rb +82 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/create_spec.rb +117 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/define_child_before_parent_spec.rb +21 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb +26 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_without_block_spec.rb +15 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/initialize_with_spec.rb +147 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/modify_factories_spec.rb +184 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/modify_inherited_spec.rb +52 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/nested_attributes_spec.rb +32 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/overrides_spec.rb +61 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/parent_spec.rb +90 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/sequence_spec.rb +33 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/stub_spec.rb +62 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/syntax/blueprint_spec.rb +34 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/syntax/generate_spec.rb +59 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/syntax/make_spec.rb +52 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/syntax/sham_spec.rb +43 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/syntax/vintage_spec.rb +217 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/traits_spec.rb +421 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/transient_attributes_spec.rb +124 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/aliases_spec.rb +31 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/attribute/association_spec.rb +28 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/attribute/dynamic_spec.rb +52 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/attribute/sequence_spec.rb +16 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/attribute/static_spec.rb +19 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/attribute_list_spec.rb +78 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/attribute_spec.rb +16 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/callback_spec.rb +41 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/declaration/implicit_spec.rb +25 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/declaration_list_spec.rb +71 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/definition_proxy_spec.rb +197 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/definition_spec.rb +104 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/evaluator_class_definer_spec.rb +54 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/factory_spec.rb +279 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/find_definitions_spec.rb +110 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/null_factory_spec.rb +13 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/null_object_spec.rb +8 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/registry_spec.rb +81 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb +47 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/strategy/attributes_for_spec.rb +18 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/strategy/build_spec.rb +7 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/strategy/create_spec.rb +13 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/strategy/stub_spec.rb +40 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/strategy_calculator_spec.rb +33 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/strategy_spec.rb +21 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl_spec.rb +22 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/spec_helper.rb +26 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/support/macros/define_constant.rb +86 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/support/matchers/callback.rb +9 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/support/matchers/declaration.rb +71 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/support/matchers/delegate.rb +44 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/support/matchers/trait.rb +9 -0
- data/vendor/bundle/gems/factory_girl-3.0.0/spec/support/shared_examples/strategy.rb +104 -0
- data/vendor/bundle/specifications/factory_girl-3.0.0.gemspec +62 -0
- metadata +147 -12
@@ -0,0 +1,95 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
factory_girl (3.0.0)
|
5
|
+
activesupport (>= 3.0.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (3.1.0)
|
11
|
+
activesupport (= 3.1.0)
|
12
|
+
bcrypt-ruby (~> 3.0.0)
|
13
|
+
builder (~> 3.0.0)
|
14
|
+
i18n (~> 0.6)
|
15
|
+
activerecord (3.1.0)
|
16
|
+
activemodel (= 3.1.0)
|
17
|
+
activesupport (= 3.1.0)
|
18
|
+
arel (~> 2.2.1)
|
19
|
+
tzinfo (~> 0.3.29)
|
20
|
+
activesupport (3.1.0)
|
21
|
+
multi_json (~> 1.0)
|
22
|
+
appraisal (0.3.8)
|
23
|
+
bundler
|
24
|
+
rake
|
25
|
+
arel (2.2.1)
|
26
|
+
aruba (0.4.6)
|
27
|
+
bcat (>= 0.6.1)
|
28
|
+
childprocess (>= 0.2.0)
|
29
|
+
cucumber (>= 1.0.2)
|
30
|
+
rdiscount (>= 1.6.8)
|
31
|
+
rspec (>= 2.6.0)
|
32
|
+
bcat (0.6.2)
|
33
|
+
rack (~> 1.0)
|
34
|
+
bcrypt-ruby (3.0.1)
|
35
|
+
bluecloth (2.1.0)
|
36
|
+
bourne (1.0)
|
37
|
+
mocha (= 0.9.8)
|
38
|
+
builder (3.0.0)
|
39
|
+
childprocess (0.2.2)
|
40
|
+
ffi (~> 1.0.6)
|
41
|
+
cucumber (1.0.6)
|
42
|
+
builder (>= 2.1.2)
|
43
|
+
diff-lcs (>= 1.1.2)
|
44
|
+
gherkin (~> 2.4.18)
|
45
|
+
json (>= 1.4.6)
|
46
|
+
term-ansicolor (>= 1.0.6)
|
47
|
+
diff-lcs (1.1.3)
|
48
|
+
ffi (1.0.9)
|
49
|
+
gherkin (2.4.21)
|
50
|
+
json (>= 1.4.6)
|
51
|
+
i18n (0.6.0)
|
52
|
+
json (1.6.1)
|
53
|
+
mocha (0.9.8)
|
54
|
+
rake
|
55
|
+
multi_json (1.0.3)
|
56
|
+
rack (1.3.3)
|
57
|
+
rake (0.9.2)
|
58
|
+
rdiscount (1.6.8)
|
59
|
+
rspec (2.6.0)
|
60
|
+
rspec-core (~> 2.6.0)
|
61
|
+
rspec-expectations (~> 2.6.0)
|
62
|
+
rspec-mocks (~> 2.6.0)
|
63
|
+
rspec-core (2.6.4)
|
64
|
+
rspec-expectations (2.6.0)
|
65
|
+
diff-lcs (~> 1.1.2)
|
66
|
+
rspec-mocks (2.6.0)
|
67
|
+
simplecov (0.6.1)
|
68
|
+
multi_json (~> 1.0)
|
69
|
+
simplecov-html (~> 0.5.3)
|
70
|
+
simplecov-html (0.5.3)
|
71
|
+
sqlite3 (1.3.4)
|
72
|
+
sqlite3-ruby (1.3.3)
|
73
|
+
sqlite3 (>= 1.3.3)
|
74
|
+
term-ansicolor (1.0.6)
|
75
|
+
timecop (0.3.5)
|
76
|
+
tzinfo (0.3.29)
|
77
|
+
yard (0.7.2)
|
78
|
+
|
79
|
+
PLATFORMS
|
80
|
+
ruby
|
81
|
+
|
82
|
+
DEPENDENCIES
|
83
|
+
activerecord
|
84
|
+
appraisal (~> 0.3.8)
|
85
|
+
aruba
|
86
|
+
bluecloth
|
87
|
+
bourne
|
88
|
+
cucumber (~> 1.0.0)
|
89
|
+
factory_girl!
|
90
|
+
mocha
|
91
|
+
rspec (~> 2.0)
|
92
|
+
simplecov
|
93
|
+
sqlite3-ruby
|
94
|
+
timecop
|
95
|
+
yard
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2008 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.
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# factory_girl [![Build Status](https://secure.travis-ci.org/thoughtbot/factory_girl.png)](http://travis-ci.org/thoughtbot/factory_girl?branch=master) [![Dependency Status](https://gemnasium.com/thoughtbot/factory_girl.png)](https://gemnasium.com/thoughtbot/factory_girl)
|
2
|
+
|
3
|
+
factory_girl is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.
|
4
|
+
|
5
|
+
If you want to use factory_girl with Rails, see
|
6
|
+
[factory_girl_rails](https://github.com/thoughtbot/factory_girl_rails).
|
7
|
+
|
8
|
+
Documentation
|
9
|
+
-------------
|
10
|
+
|
11
|
+
You should find the documentation for your version of factory_girl on [Rubygems](https://rubygems.org/gems/factory_girl).
|
12
|
+
|
13
|
+
See [GETTING_STARTED](https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md) for information on defining and using factories.
|
14
|
+
|
15
|
+
Install
|
16
|
+
--------
|
17
|
+
|
18
|
+
```shell
|
19
|
+
gem install factory_girl
|
20
|
+
```
|
21
|
+
or add the following line to Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'factory_girl'
|
25
|
+
```
|
26
|
+
and run `bundle install` from your shell.
|
27
|
+
|
28
|
+
More Information
|
29
|
+
----------------
|
30
|
+
|
31
|
+
* [Rubygems](https://rubygems.org/gems/factory_girl)
|
32
|
+
* [Mailing list](http://groups.google.com/group/factory_girl)
|
33
|
+
* [Issues](https://github.com/thoughtbot/factory_girl/issues)
|
34
|
+
* [GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS](http://robots.thoughtbot.com/)
|
35
|
+
|
36
|
+
Contributing
|
37
|
+
------------
|
38
|
+
|
39
|
+
Please see the [contribution guidelines](https://github.com/thoughtbot/factory_girl/blob/master/CONTRIBUTION_GUIDELINES.md).
|
40
|
+
|
41
|
+
Credits
|
42
|
+
-------
|
43
|
+
|
44
|
+
factory_girl was written by Joe Ferris with contributions from several authors, including:
|
45
|
+
|
46
|
+
* Alex Sharp
|
47
|
+
* Eugene Bolshakov
|
48
|
+
* Jon Yurek
|
49
|
+
* Josh Nichols
|
50
|
+
* Josh Owens
|
51
|
+
* Nate Sutton
|
52
|
+
* Josh Clayton
|
53
|
+
* Thomas Walpole
|
54
|
+
|
55
|
+
The syntax layers are derived from software written by the following authors:
|
56
|
+
|
57
|
+
* Pete Yandell
|
58
|
+
* Rick Bradley
|
59
|
+
* Yossef Mendelssohn
|
60
|
+
|
61
|
+
![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
|
62
|
+
|
63
|
+
factory_girl is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
|
64
|
+
|
65
|
+
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
66
|
+
|
67
|
+
License
|
68
|
+
-------
|
69
|
+
|
70
|
+
factory_girl is Copyright © 2008-2011 Joe Ferris and thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'rake'
|
4
|
+
require 'appraisal'
|
5
|
+
require 'yard'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
require 'cucumber/rake/task'
|
8
|
+
|
9
|
+
Bundler::GemHelper.install_tasks
|
10
|
+
|
11
|
+
desc 'Default: run the specs and features.'
|
12
|
+
task :default => 'spec:unit' do
|
13
|
+
system("bundle exec rake -s appraisal spec:acceptance features;")
|
14
|
+
end
|
15
|
+
|
16
|
+
namespace :spec do
|
17
|
+
desc "Run unit specs"
|
18
|
+
RSpec::Core::RakeTask.new('unit') do |t|
|
19
|
+
t.pattern = 'spec/{*_spec.rb,factory_girl/**/*_spec.rb}'
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Run acceptance specs"
|
23
|
+
RSpec::Core::RakeTask.new('acceptance') do |t|
|
24
|
+
t.pattern = 'spec/acceptance/**/*_spec.rb'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Run the unit and acceptance specs"
|
29
|
+
task :spec => ['spec:unit', 'spec:acceptance']
|
30
|
+
|
31
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
32
|
+
t.fork = true
|
33
|
+
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
|
34
|
+
end
|
35
|
+
|
36
|
+
YARD::Rake::YardocTask.new do |t|
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
default: -r features features
|
@@ -0,0 +1,38 @@
|
|
1
|
+
$LOAD_PATH << File.expand_path("../lib", __FILE__)
|
2
|
+
require 'factory_girl/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = %q{factory_girl}
|
6
|
+
s.version = FactoryGirl::VERSION
|
7
|
+
s.summary = %q{factory_girl provides a framework and DSL for defining and
|
8
|
+
using model instance factories.}
|
9
|
+
s.description = %q{factory_girl provides a framework and DSL for defining and
|
10
|
+
using factories - less error-prone, more explicit, and
|
11
|
+
all-around easier to work with than fixtures.}
|
12
|
+
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.test_files = `git ls-files -- Appraisals {spec,features,gemfiles}/*`.split("\n")
|
15
|
+
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
|
18
|
+
|
19
|
+
s.authors = ["Josh Clayton", "Joe Ferris"]
|
20
|
+
s.email = ["jclayton@thoughtbot.com", "jferris@thoughtbot.com"]
|
21
|
+
|
22
|
+
s.homepage = "https://github.com/thoughtbot/factory_girl"
|
23
|
+
|
24
|
+
s.add_dependency("activesupport", ">= 3.0.0")
|
25
|
+
|
26
|
+
s.add_development_dependency("rspec", "~> 2.0")
|
27
|
+
s.add_development_dependency("cucumber", "~> 1.0.0")
|
28
|
+
s.add_development_dependency("timecop")
|
29
|
+
s.add_development_dependency("simplecov")
|
30
|
+
s.add_development_dependency("aruba")
|
31
|
+
s.add_development_dependency("mocha")
|
32
|
+
s.add_development_dependency("bourne")
|
33
|
+
s.add_development_dependency("appraisal", "~> 0.3.8")
|
34
|
+
s.add_development_dependency("sqlite3-ruby")
|
35
|
+
s.add_development_dependency("yard")
|
36
|
+
s.add_development_dependency("bluecloth")
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,237 @@
|
|
1
|
+
Feature: Use step definitions generated by factories
|
2
|
+
|
3
|
+
Scenario: create a post and verify its attributes
|
4
|
+
Given the following post exists:
|
5
|
+
| Title | Body |
|
6
|
+
| a fun title | here is the content |
|
7
|
+
Then I should find the following for the last post:
|
8
|
+
| title | body |
|
9
|
+
| a fun title | here is the content |
|
10
|
+
|
11
|
+
Scenario: create a post and verify its attributes without the trailing colon
|
12
|
+
Given the following post exists
|
13
|
+
| Title | Body |
|
14
|
+
| a fun title | here is the content |
|
15
|
+
Then I should find the following for the last post:
|
16
|
+
| title | body |
|
17
|
+
| a fun title | here is the content |
|
18
|
+
|
19
|
+
Scenario: create a post without a table and verify its attributes
|
20
|
+
Given a post exists with a title of "a fun title"
|
21
|
+
Then I should find the following for the last post:
|
22
|
+
| title |
|
23
|
+
| a fun title |
|
24
|
+
|
25
|
+
Scenario: flexible English when creating posts
|
26
|
+
Given an post exists with an title of "a fun title"
|
27
|
+
Then I should find the following for the last post:
|
28
|
+
| title |
|
29
|
+
| a fun title |
|
30
|
+
|
31
|
+
Scenario: create a post with an underscore in an attribute name
|
32
|
+
Given a post exists with an author ID of "5"
|
33
|
+
Then I should find the following for the last post:
|
34
|
+
| author_id |
|
35
|
+
| 5 |
|
36
|
+
|
37
|
+
Scenario: create several posts
|
38
|
+
Given the following posts exist:
|
39
|
+
| Title | Body |
|
40
|
+
| one | first |
|
41
|
+
| two | second |
|
42
|
+
| three | third |
|
43
|
+
Then I should find the following for the last post:
|
44
|
+
| title | body |
|
45
|
+
| three | third |
|
46
|
+
And there should be 3 posts
|
47
|
+
|
48
|
+
Scenario: create a post with a new author
|
49
|
+
Given the following post exists:
|
50
|
+
| Title | Author |
|
51
|
+
| a title | ID: 123 |
|
52
|
+
Then I should find the following for the last post:
|
53
|
+
| title | author_id |
|
54
|
+
| a title | 123 |
|
55
|
+
And I should find the following for the last user:
|
56
|
+
| id |
|
57
|
+
| 123 |
|
58
|
+
|
59
|
+
Scenario: create a post with an existing author
|
60
|
+
Given the following user exists:
|
61
|
+
| ID | Name |
|
62
|
+
| 123 | Joe |
|
63
|
+
And the following post exists:
|
64
|
+
| Title | Author |
|
65
|
+
| a title | Name: Joe |
|
66
|
+
Then I should find the following for the last post:
|
67
|
+
| title | author_id |
|
68
|
+
| a title | 123 |
|
69
|
+
And there should be 1 user
|
70
|
+
|
71
|
+
Scenario: create a titled post with a new author (inherited association)
|
72
|
+
Given the following titled post exists:
|
73
|
+
| Title | Author |
|
74
|
+
| A Post with a Title | ID: 123 |
|
75
|
+
Then I should find the following for the last post:
|
76
|
+
| title | author_id |
|
77
|
+
| A Post with a Title | 123 |
|
78
|
+
|
79
|
+
Scenario: create post with and without a category association
|
80
|
+
Given the following users exist:
|
81
|
+
| ID | Name |
|
82
|
+
| 123 | Joe |
|
83
|
+
And the following posts exist:
|
84
|
+
| Title | Author | Category |
|
85
|
+
| a title | Name: Joe | Name: programming |
|
86
|
+
| a title without a category | Name: Joe | |
|
87
|
+
Then I should find the following for the last post:
|
88
|
+
| title | category_id |
|
89
|
+
| a title without a category | |
|
90
|
+
|
91
|
+
Scenario: create a user without attributes
|
92
|
+
Given a user exists
|
93
|
+
Then there should be 1 user
|
94
|
+
|
95
|
+
Scenario: create several users without attributes
|
96
|
+
Given 3 users exist
|
97
|
+
Then there should be 3 users
|
98
|
+
|
99
|
+
Scenario: create several users with one attribute
|
100
|
+
Given 3 users exist with a name of "John"
|
101
|
+
Then there should be 3 users
|
102
|
+
And I should find the following for the last user:
|
103
|
+
| name |
|
104
|
+
| John |
|
105
|
+
|
106
|
+
Scenario: create instances of a factory with an underscore in its name
|
107
|
+
Given an admin user exists with a name of "John"
|
108
|
+
Then I should find the following for the last user:
|
109
|
+
| name | admin |
|
110
|
+
| John | true |
|
111
|
+
|
112
|
+
Scenario: create a several instances of a factory with an underscore in its name
|
113
|
+
Given 3 admin users exist
|
114
|
+
Then I should find the following for the last user:
|
115
|
+
| admin |
|
116
|
+
| true |
|
117
|
+
|
118
|
+
Scenario: use true values when creating instances
|
119
|
+
Given the following user exists:
|
120
|
+
| name | admin |
|
121
|
+
| Bill | true |
|
122
|
+
Then I should find the following for the last user:
|
123
|
+
| name | admin |
|
124
|
+
| Bill | true |
|
125
|
+
|
126
|
+
Scenario: use false values when creating instances
|
127
|
+
Given the following user exists:
|
128
|
+
| name | admin |
|
129
|
+
| Mike | false |
|
130
|
+
Then I should find the following for the last user:
|
131
|
+
| name | admin |
|
132
|
+
| Mike | false |
|
133
|
+
|
134
|
+
Scenario: Properly pluralize words
|
135
|
+
Given the following categories exist:
|
136
|
+
| name |
|
137
|
+
| Bed |
|
138
|
+
| Test Drive |
|
139
|
+
And 2 categories exist
|
140
|
+
And 2 categories exist with a name of "Future"
|
141
|
+
Then there should be 6 categories
|
142
|
+
|
143
|
+
Scenario: create a post with an existing category group
|
144
|
+
Given the following category exists:
|
145
|
+
| ID | name | category group |
|
146
|
+
| 123 | fiction | Name: books |
|
147
|
+
And the following post exists:
|
148
|
+
| Title | Author | Category |
|
149
|
+
| a title | Name: Joe | Category Group: Name: books |
|
150
|
+
Then I should find the following for the last post:
|
151
|
+
| title | category_id |
|
152
|
+
| a title | 123 |
|
153
|
+
|
154
|
+
Scenario: create a post with an existing category group and a new category
|
155
|
+
Given the following category group exists:
|
156
|
+
| ID | name |
|
157
|
+
| 456 | books |
|
158
|
+
And the following post exists:
|
159
|
+
| Title | Author | Category |
|
160
|
+
| a title | Name: Joe | Category Group: Name: books |
|
161
|
+
Then I should find the following for the last post:
|
162
|
+
| title |
|
163
|
+
| a title |
|
164
|
+
And I should find the following for the last category:
|
165
|
+
| category_group_id |
|
166
|
+
| 456 |
|
167
|
+
|
168
|
+
Scenario: factory name and attributes should not be case sensitive
|
169
|
+
Given the following category exists:
|
170
|
+
| name | category group |
|
171
|
+
| fiction | Name: books |
|
172
|
+
Then there should be 1 category
|
173
|
+
Given the following Category exists:
|
174
|
+
| name | category group |
|
175
|
+
| science | Name: books |
|
176
|
+
Then there should be 2 categories
|
177
|
+
|
178
|
+
Scenario: factory name and attributes should not be case sensitive
|
179
|
+
Given a user exists
|
180
|
+
Then there should be 1 user
|
181
|
+
Given a User exists
|
182
|
+
Then there should be 2 Users
|
183
|
+
|
184
|
+
Scenario: factory name and attributes should not be case sensitive
|
185
|
+
Given 3 users exist
|
186
|
+
Then there should be 3 users
|
187
|
+
Given 3 Users exist
|
188
|
+
Then there should be 6 Users
|
189
|
+
|
190
|
+
Scenario: factory name and attributes should not be case sensitive
|
191
|
+
Given a category exists with a name of "fiction"
|
192
|
+
Then there should be 1 category
|
193
|
+
Given a Category exists with a name of "science"
|
194
|
+
Then there should be 2 Categories
|
195
|
+
|
196
|
+
Scenario: factory name and attributes should not be case sensitive
|
197
|
+
Given 3 categories exist with a name of "fiction"
|
198
|
+
Then there should be 3 categories
|
199
|
+
Given 3 Categories exist with a name of "science"
|
200
|
+
Then there should be 6 Categories
|
201
|
+
|
202
|
+
Scenario: step definitions work correctly with aliases
|
203
|
+
Given the following person exists:
|
204
|
+
| ID | Name |
|
205
|
+
| 123 | Joe |
|
206
|
+
Then I should find the following for the last user:
|
207
|
+
| id | name |
|
208
|
+
| 123 | Joe |
|
209
|
+
|
210
|
+
Scenario: pass a factory girl table as an argument and modify it
|
211
|
+
Given these super users exist:
|
212
|
+
| id | Name |
|
213
|
+
| 123 | Joe |
|
214
|
+
Then I should find the following for the last user:
|
215
|
+
| id | name | admin |
|
216
|
+
| 123 | Joe | true |
|
217
|
+
|
218
|
+
Scenario: Transform parses string data into array before assigning to an association
|
219
|
+
Given the following tags exist:
|
220
|
+
| name |
|
221
|
+
| funky |
|
222
|
+
| cool |
|
223
|
+
| hip |
|
224
|
+
And the following post exists:
|
225
|
+
| title | tags |
|
226
|
+
| Tagged post | cool, hip |
|
227
|
+
Then the post "Tagged post" should have the following tags:
|
228
|
+
| name |
|
229
|
+
| cool |
|
230
|
+
| hip |
|
231
|
+
And the post "Tagged post" should not have the following tags:
|
232
|
+
| name |
|
233
|
+
| funky |
|
234
|
+
|
235
|
+
Scenario: step definitions work correctly with ORMs that have simple `columns`
|
236
|
+
Given a simple column exists
|
237
|
+
Then there should be 1 SimpleColumn
|