mirror of
https://github.com/thoughtbot/factory_bot_rails.git
synced 2022-11-09 11:49:18 -05:00
Improve the way we switch between project Gemfile and appraisal gemfiles
Previously, the railties required by the project gemspec was in conflict with the rails versions being pulled in by Appraisal. There were situations where a newer rails app was generated by `rails new...` even though the Appraisal gemfiles/ value should have been setting it correctly. We need to be able to use the versions of things specified in the appraisal gemfiles/ specify the version of rails for the initial generation of the applications, but subsequently allow those applications to point to the `Gemfile` within the newly generated rails apps, rather than wherever BUNDLE_GEMFILE was previously set by Appraisal.
This commit is contained in:
parent
b7f5c5d9d0
commit
95eaa4af9a
7 changed files with 23 additions and 58 deletions
|
@ -1,19 +1,15 @@
|
|||
@disable-bundler
|
||||
Feature:
|
||||
In order to not have to manually configure factory girl as the testing fixture replacement
|
||||
by using the --fixture-replacement=factory_girl option
|
||||
as a Rails3 and Factory Girl user
|
||||
I would like the Factory Girl Rails gem to configure Factory Girl
|
||||
as the fixture replacement.
|
||||
In order to not have to manually configure factory girl as the testing fixture replacement by using the --fixture-replacement=factory_girl option as a Rails3 and Factory Girl user
|
||||
I would like the Factory Girl Rails gem to configure Factory Girl as the fixture replacement.
|
||||
|
||||
Background:
|
||||
Given I successfully run `bundle exec rails new testapp`
|
||||
And I cd to "testapp"
|
||||
And I add "factory_girl_rails" from this project as a dependency
|
||||
And I configure the database connection for the application
|
||||
And I configure the database connection for the application
|
||||
And I reset Bundler environment variable
|
||||
|
||||
Scenario: Using Factory Girl and Factory Girl Rails with Test Unit generates
|
||||
a factory file and does not generate a fixture file
|
||||
Scenario: Using Factory Girl and Factory Girl Rails with Test Unit generates a factory file and does not generate a fixture file
|
||||
And I successfully run `bundle install`
|
||||
And I successfully run `bundle exec rails generate model User name:string`
|
||||
Then the following files should exist:
|
||||
|
@ -21,9 +17,8 @@ Feature:
|
|||
And the following files should not exist:
|
||||
| test/fixtures/users.yml |
|
||||
|
||||
|
||||
Scenario: Using Factory Girl and Factory Girl Rails with RSpec should generate a factory file
|
||||
And I add "rspec-rails" as a dependency
|
||||
When I add "rspec-rails" as a dependency
|
||||
And I successfully run `bundle install`
|
||||
And I successfully run `bundle exec rails generate model User name:string`
|
||||
Then the following files should exist:
|
||||
|
|
|
@ -3,12 +3,14 @@ Feature:
|
|||
As a user of Rails3 and factory_girl
|
||||
I would like to use factory_girl_rails generators.
|
||||
|
||||
Scenario: The factory_girl_rails generators create a factory file
|
||||
for each model that I generate
|
||||
When I successfully run `bundle exec rails new testapp`
|
||||
Background:
|
||||
Given I successfully run `bundle exec rails new testapp`
|
||||
And I cd to "testapp"
|
||||
And I add "factory_girl_rails" from this project as a dependency
|
||||
And I configure the database connection for the application
|
||||
And I configure the database connection for the application
|
||||
And I reset Bundler environment variable
|
||||
|
||||
Scenario: The factory_girl_rails generators create a factory file for each model that I generate
|
||||
When I successfully run `bundle install`
|
||||
And I successfully run `bundle exec rails generate model User name:string --fixture-replacement=factory_girl`
|
||||
And I successfully run `bundle exec rails generate model Namespaced::User name:string --fixture-replacement=factory_girl`
|
||||
|
@ -17,12 +19,7 @@ Feature:
|
|||
And the file "test/factories/users.rb" should contain "factory :user do"
|
||||
And the file "test/factories/namespaced_users.rb" should contain "factory :namespaced_user, :class => 'Namespaced::User' do"
|
||||
|
||||
Scenario: The factory_girl_rails generators create a factory file with a
|
||||
custom name for each model that I generate
|
||||
When I successfully run `bundle exec rails new testapp`
|
||||
And I cd to "testapp"
|
||||
And I add "factory_girl_rails" from this project as a dependency
|
||||
And I configure the database connection for the application
|
||||
Scenario: The factory_girl_rails generators create a factory file with a custom name for each model that I generate
|
||||
When I successfully run `bundle install`
|
||||
And I set the FactoryGirl :suffix option to "factory"
|
||||
And I successfully run `bundle exec rails generate model User name:string --fixture-replacement=factory_girl`
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
Feature: automatically load step definitions
|
||||
|
||||
Background:
|
||||
When I successfully run `bundle exec rails new testapp`
|
||||
And I cd to "testapp"
|
||||
And I add "factory_girl_rails" from this project as a dependency
|
||||
And I configure the database connection for the application
|
||||
And I configure the database connection for the application
|
||||
And I reset Bundler environment variable
|
||||
When I successfully run `bundle install`
|
||||
And I write to "db/migrate/1_create_users.rb" with:
|
||||
"""
|
||||
|
@ -22,7 +24,6 @@ Feature: automatically load step definitions
|
|||
end
|
||||
"""
|
||||
|
||||
@disable-bundler
|
||||
Scenario: generate a rails 3 application and use factory definitions
|
||||
When I write to "test/factories.rb" with:
|
||||
"""
|
||||
|
@ -46,7 +47,6 @@ Feature: automatically load step definitions
|
|||
When I successfully run `bundle exec rake test --trace`
|
||||
Then the output should contain "1 tests, 1 assertions, 0 failures, 0 errors"
|
||||
|
||||
@disable-bundler
|
||||
Scenario: use factories advertised by railties/engines/3rd-party gems
|
||||
When I append to "config/application.rb" with:
|
||||
"""
|
||||
|
@ -83,4 +83,4 @@ Feature: automatically load step definitions
|
|||
end
|
||||
"""
|
||||
When I successfully run `bundle exec rake test --trace`
|
||||
Then the output should contain "1 tests, 1 assertions, 0 failures, 0 errors"
|
||||
Then the output should contain "1 tests, 1 assertions, 0 failures, 0 errors"
|
||||
|
|
3
features/step_definitions/appraisal.rb
Normal file
3
features/step_definitions/appraisal.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
When /^I reset Bundler environment variable$/ do
|
||||
unset_bundler_env_vars
|
||||
end
|
|
@ -31,10 +31,6 @@ GEM
|
|||
activesupport (= 3.0.17)
|
||||
arel (~> 2.0.10)
|
||||
tzinfo (~> 0.3.23)
|
||||
activerecord-jdbc-adapter (1.2.2.1)
|
||||
activerecord-jdbcsqlite3-adapter (1.2.2.1)
|
||||
activerecord-jdbc-adapter (~> 1.2.2.1)
|
||||
jdbc-sqlite3 (~> 3.7.2)
|
||||
activeresource (3.0.17)
|
||||
activemodel (= 3.0.17)
|
||||
activesupport (= 3.0.17)
|
||||
|
@ -61,15 +57,10 @@ GEM
|
|||
factory_girl (4.1.0)
|
||||
activesupport (>= 3.0.0)
|
||||
ffi (1.2.0)
|
||||
ffi (1.2.0-java)
|
||||
gherkin (2.11.5)
|
||||
json (>= 1.4.6)
|
||||
gherkin (2.11.5-java)
|
||||
json (>= 1.4.6)
|
||||
i18n (0.5.0)
|
||||
jdbc-sqlite3 (3.7.2)
|
||||
json (1.7.5)
|
||||
json (1.7.5-java)
|
||||
mail (2.2.19)
|
||||
activesupport (>= 2.3.6)
|
||||
i18n (>= 0.4.0)
|
||||
|
@ -96,7 +87,7 @@ GEM
|
|||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (~> 0.14.4)
|
||||
rake (10.0.2)
|
||||
rake (10.0.3)
|
||||
rdoc (3.12)
|
||||
json (~> 1.4)
|
||||
rspec (2.11.0)
|
||||
|
@ -115,7 +106,6 @@ GEM
|
|||
tzinfo (0.3.35)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
|
|
|
@ -31,10 +31,6 @@ GEM
|
|||
activesupport (= 3.1.8)
|
||||
arel (~> 2.2.3)
|
||||
tzinfo (~> 0.3.29)
|
||||
activerecord-jdbc-adapter (1.2.2.1)
|
||||
activerecord-jdbcsqlite3-adapter (1.2.2.1)
|
||||
activerecord-jdbc-adapter (~> 1.2.2.1)
|
||||
jdbc-sqlite3 (~> 3.7.2)
|
||||
activeresource (3.1.8)
|
||||
activemodel (= 3.1.8)
|
||||
activesupport (= 3.1.8)
|
||||
|
@ -61,16 +57,11 @@ GEM
|
|||
factory_girl (4.1.0)
|
||||
activesupport (>= 3.0.0)
|
||||
ffi (1.2.0)
|
||||
ffi (1.2.0-java)
|
||||
gherkin (2.11.5)
|
||||
json (>= 1.4.6)
|
||||
gherkin (2.11.5-java)
|
||||
json (>= 1.4.6)
|
||||
hike (1.2.1)
|
||||
i18n (0.6.1)
|
||||
jdbc-sqlite3 (3.7.2)
|
||||
json (1.7.5)
|
||||
json (1.7.5-java)
|
||||
mail (2.3.3)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
|
@ -102,7 +93,7 @@ GEM
|
|||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (~> 0.14.6)
|
||||
rake (10.0.2)
|
||||
rake (10.0.3)
|
||||
rdoc (3.12)
|
||||
json (~> 1.4)
|
||||
rspec (2.11.0)
|
||||
|
@ -126,7 +117,6 @@ GEM
|
|||
tzinfo (0.3.35)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
|
|
|
@ -29,10 +29,6 @@ GEM
|
|||
activesupport (= 3.2.9)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activerecord-jdbc-adapter (1.2.2.1)
|
||||
activerecord-jdbcsqlite3-adapter (1.2.2.1)
|
||||
activerecord-jdbc-adapter (~> 1.2.2.1)
|
||||
jdbc-sqlite3 (~> 3.7.2)
|
||||
activeresource (3.2.9)
|
||||
activemodel (= 3.2.9)
|
||||
activesupport (= 3.2.9)
|
||||
|
@ -60,17 +56,12 @@ GEM
|
|||
factory_girl (4.1.0)
|
||||
activesupport (>= 3.0.0)
|
||||
ffi (1.2.0)
|
||||
ffi (1.2.0-java)
|
||||
gherkin (2.11.5)
|
||||
json (>= 1.4.6)
|
||||
gherkin (2.11.5-java)
|
||||
json (>= 1.4.6)
|
||||
hike (1.2.1)
|
||||
i18n (0.6.1)
|
||||
jdbc-sqlite3 (3.7.2)
|
||||
journey (1.0.4)
|
||||
json (1.7.5)
|
||||
json (1.7.5-java)
|
||||
mail (2.4.4)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
|
@ -100,7 +91,7 @@ GEM
|
|||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (10.0.2)
|
||||
rake (10.0.3)
|
||||
rdoc (3.12)
|
||||
json (~> 1.4)
|
||||
rspec (2.11.0)
|
||||
|
@ -125,7 +116,6 @@ GEM
|
|||
tzinfo (0.3.35)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue