mirror of
https://github.com/thoughtbot/factory_bot_rails.git
synced 2022-11-09 11:49:18 -05:00
00cb2eabb1
* Remove gemfiles from version control to match same testing style as Clearance and Suspenders. * MiniTest does not need to be manually included as it is automatically included by Rails by default. * Add spring for Rails 4.1. * Disable Spring to get specs to pass on Rails 4.1. * Add therubyrhino for JRuby. * Remove old references to Rails 3. * Fix JRuby test where output is "1 runs", not "1 tests". * Remove Rails 3.0 reference to "turn".
85 lines
3.9 KiB
Gherkin
85 lines
3.9 KiB
Gherkin
Feature:
|
|
In order to not have to manually configure Factory Girl as the Rails testing fixture replacement by using the --fixture-replacement=factory_girl option
|
|
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
|
|
|
|
Scenario: Using Factory Girl and Factory Girl Rails with Test Unit generates a factory file and does not generate a fixture file
|
|
And I run `bundle install` with a clean environment
|
|
And I run `bundle exec rails generate model User name:string` with a clean environment
|
|
Then the following files should exist:
|
|
| test/factories/users.rb |
|
|
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
|
|
When I add "rspec-rails" as a dependency
|
|
And I configure the factories as:
|
|
"""
|
|
config.generators do |g|
|
|
g.test_framework :rspec, fixture: true
|
|
g.fixture_replacement :factory_girl
|
|
end
|
|
"""
|
|
And I run `bundle install` with a clean environment
|
|
Then the output should contain "rspec-rails"
|
|
And I run `bundle exec rails generate model User name:string` with a clean environment
|
|
Then the following files should exist:
|
|
| spec/factories/users.rb |
|
|
And the following files should not exist:
|
|
| spec/fixtures/users.yml |
|
|
|
|
Scenario: Using Factory Girl and Factory Girl Rails does not override a manually-configured factories directory using RSpec
|
|
When I add "rspec-rails" as a dependency
|
|
And I configure the factories directory as "custom/dir"
|
|
And I run `bundle install` with a clean environment
|
|
Then the output should contain "rspec-rails"
|
|
And I run `bundle exec rails generate model User name:string` with a clean environment
|
|
Then the following files should not exist:
|
|
| test/factories/users.rb |
|
|
| spec/factories/users.rb |
|
|
But the following files should exist:
|
|
| custom/dir/users.rb |
|
|
|
|
Scenario: Using Factory Girl and Factory Girl Rails does not override a manually-configured factories directory using Test::Unit
|
|
When I configure the factories directory as "custom/dir"
|
|
And I run `bundle install` with a clean environment
|
|
And I run `bundle exec rails generate model User name:string` with a clean environment
|
|
Then the following files should not exist:
|
|
| test/factories/users.rb |
|
|
| spec/factories/users.rb |
|
|
But the following files should exist:
|
|
| custom/dir/users.rb |
|
|
|
|
Scenario: Using Factory Girl Rails with MiniTest should generate a factory file
|
|
When I run `bundle install` with a clean environment
|
|
And I run `bundle exec rails generate model User name:string` with a clean environment
|
|
Then the following files should exist:
|
|
| test/factories/users.rb |
|
|
But the following files should not exist:
|
|
| spec/fixtures/users.yml |
|
|
|
|
Scenario: Using Factory Girl Rails with MiniTest and a custom directory should generate a factory file
|
|
When I configure the factories directory as "custom/dir"
|
|
And I run `bundle install` with a clean environment
|
|
And I run `bundle exec rails generate model User name:string` with a clean environment
|
|
Then the following files should exist:
|
|
| custom/dir/users.rb |
|
|
But the following files should not exist:
|
|
| spec/fixtures/users.yml |
|
|
|
|
Scenario: Disable Factory Girl generator
|
|
When I configure the factories as:
|
|
"""
|
|
config.generators do |g|
|
|
g.factory_girl false
|
|
end
|
|
"""
|
|
And I run `bundle install` with a clean environment
|
|
And I run `bundle exec rails generate model User name:string` with a clean environment
|
|
Then the following files should not exist:
|
|
| test/factories/users.rb |
|
|
| spec/factories/users.rb |
|