factory_girl_rails 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
factory_girl_rails (1.
|
5
|
-
factory_girl (~> 2.
|
4
|
+
factory_girl_rails (1.3.0)
|
5
|
+
factory_girl (~> 2.2.0)
|
6
6
|
railties (>= 3.0.0)
|
7
7
|
|
8
8
|
GEM
|
@@ -56,7 +56,8 @@ GEM
|
|
56
56
|
diff-lcs (1.1.2)
|
57
57
|
erubis (2.6.6)
|
58
58
|
abstract (>= 1.0.0)
|
59
|
-
factory_girl (2.
|
59
|
+
factory_girl (2.2.0)
|
60
|
+
activesupport
|
60
61
|
ffi (1.0.9)
|
61
62
|
gherkin (2.4.1)
|
62
63
|
json (>= 1.4.6)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
@disable-bundler
|
2
|
+
Feature:
|
3
|
+
In order to not have to manually configure factory girl as the testing fixture replacement
|
4
|
+
by using the --fixture-replacement=factory_girl option
|
5
|
+
as a Rails3 and Factory Girl user
|
6
|
+
I would like the Factory Girl Rails gem to configure Factory Girl
|
7
|
+
as the fixture replacement.
|
8
|
+
|
9
|
+
Background:
|
10
|
+
Given I successfully run `bundle exec rails new testapp`
|
11
|
+
And I cd to "testapp"
|
12
|
+
And I add "factory_girl_rails" from this project as a dependency
|
13
|
+
|
14
|
+
Scenario: Using Factory Girl and Factory Girl Rails with Test Unit generates
|
15
|
+
a factory file and does not generate a fixture file
|
16
|
+
And I successfully run `bundle install`
|
17
|
+
And I successfully run `bundle exec rails generate model User name:string`
|
18
|
+
Then the following files should exist:
|
19
|
+
| test/factories/users.rb |
|
20
|
+
And the following files should not exist:
|
21
|
+
| test/fixtures/users.yml |
|
22
|
+
|
23
|
+
|
24
|
+
Scenario: Using Factory Girl and Factory Girl Rails with RSpec should generate a factory file
|
25
|
+
And I add "rspec-rails" as a dependency
|
26
|
+
And I successfully run `bundle install`
|
27
|
+
And I successfully run `bundle exec rails generate model User name:string`
|
28
|
+
Then the following files should exist:
|
29
|
+
| spec/factories/users.rb |
|
30
|
+
And the following files should not exist:
|
31
|
+
| spec/fixtures/users.yml |
|
@@ -1,3 +1,7 @@
|
|
1
1
|
When /^I add "([^"]+)" from this project as a dependency$/ do |gem_name|
|
2
|
-
append_to_file('Gemfile', %{gem "#{gem_name}", :path => "#{PROJECT_ROOT}"})
|
2
|
+
append_to_file('Gemfile', %{gem "#{gem_name}", :path => "#{PROJECT_ROOT}"\n})
|
3
|
+
end
|
4
|
+
|
5
|
+
When /^I add "([^"]+)" as a dependency$/ do |gem_name|
|
6
|
+
append_to_file('Gemfile', %{gem "#{gem_name}"\n})
|
3
7
|
end
|
@@ -3,11 +3,22 @@ require 'rails'
|
|
3
3
|
|
4
4
|
module FactoryGirl
|
5
5
|
class Railtie < Rails::Railtie
|
6
|
+
|
7
|
+
initializer "factory_girl.set_fixture_replacement" do
|
8
|
+
generators = config.respond_to?(:app_generators) ? config.app_generators : config.generators
|
9
|
+
|
10
|
+
if generators.options[:rails][:test_framework] == :rspec
|
11
|
+
generators.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
12
|
+
else
|
13
|
+
generators.test_framework :test_unit, :fixture => false, :fixture_replacement => :factory_girl
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
6
17
|
config.after_initialize do
|
7
18
|
FactoryGirl.definition_file_paths = [
|
8
|
-
|
9
|
-
|
10
|
-
|
19
|
+
File.join(Rails.root, 'factories'),
|
20
|
+
File.join(Rails.root, 'test', 'factories'),
|
21
|
+
File.join(Rails.root, 'spec', 'factories')
|
11
22
|
]
|
12
23
|
FactoryGirl.find_definitions
|
13
24
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: factory_girl_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.
|
5
|
+
version: 1.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Joe Ferris
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-10-15 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - ~>
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 2.
|
35
|
+
version: 2.2.0
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id002
|
38
38
|
- !ruby/object:Gem::Dependency
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/generators/factory_girl/model/model_generator.rb
|
114
114
|
- lib/generators/factory_girl/model/templates/fixtures.rb
|
115
115
|
- lib/generators/factory_girl.rb
|
116
|
+
- features/fixture_replacement_config.feature
|
116
117
|
- features/generators.feature
|
117
118
|
- features/load_definitions.feature
|
118
119
|
- features/step_definitions/rails_steps.rb
|
@@ -146,6 +147,7 @@ signing_key:
|
|
146
147
|
specification_version: 3
|
147
148
|
summary: factory_girl_rails provides integration between factory_girl and rails 3
|
148
149
|
test_files:
|
150
|
+
- features/fixture_replacement_config.feature
|
149
151
|
- features/generators.feature
|
150
152
|
- features/load_definitions.feature
|
151
153
|
- features/step_definitions/rails_steps.rb
|