Skip to content

Commit

Permalink
Rename all girl -> bot
Browse files Browse the repository at this point in the history
* Rename files and code
* Change factory_girl dependency to factory_bot

This change will bring _rails name in line with factory_bot
thoughtbot/factory_bot@c716ce0
  • Loading branch information
Avielle Wolfe authored and Avielle committed Oct 20, 2017
1 parent dca3731 commit c5d1151
Show file tree
Hide file tree
Showing 26 changed files with 156 additions and 135 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ agree to abide by the thoughtbot [code of conduct].

Fork, then clone the repo:

git clone [email protected]:your-username/factory_girl_rails.git
git clone [email protected]:your-username/factory_bot_rails.git

Set up your machine:

Expand All @@ -23,7 +23,7 @@ Make your change. Add tests for your change. Make the tests pass:

Push to your fork and [submit a pull request][pr].

[pr]: https://github.com/thoughtbot/factory_girl_rails/compare/
[pr]: https://github.com/thoughtbot/factory_bot_rails/compare/

At this point you're waiting on us. We like to at least comment on pull requests
within three business days (and, typically, one business day). We may suggest
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gemspec
gemspec name: 'factory_bot_rails'

gem 'appraisal'
gem 'aruba'
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: .
specs:
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
factory_bot_rails (4.8.0)
factory_bot (~> 4.8.2)
railties (>= 3.0.0)

GEM
Expand Down Expand Up @@ -63,7 +63,7 @@ GEM
diff-lcs (1.2.5)
erubis (2.7.0)
execjs (2.0.2)
factory_girl (4.8.0)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
ffi (1.9.3)
ffi (1.9.3-java)
Expand Down Expand Up @@ -129,7 +129,7 @@ DEPENDENCIES
aruba
coffee-rails
cucumber (= 1.3.19)
factory_girl_rails!
factory_bot_rails!
jdbc-sqlite3
jquery-rails
jruby-openssl
Expand Down
4 changes: 2 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
factory_girl_rails versioning is synced with factory_girl releases. For this reason
factory_bot_rails versioning is synced with factory_bot releases. For this reason
there might not be any notable changes in new versions of this project.

4.7.0 (April 1, 2016)
No notable changes

4.6.0 (February 1, 2016)
No notable changes

4.5.0 (October 17, 2014)
Improved README

Expand Down
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# factory_girl_rails [![Build Status][ci-image]][ci] [![Code Climate][grade-image]][grade]
# factory_bot_rails [![Build Status][ci-image]][ci] [![Code Climate][grade-image]][grade]

[factory_girl][fg] is a fixtures replacement with a straightforward definition
[factory_bot][fb] 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.

## Rails

factory_girl_rails provides Rails integration for [factory_girl][fg].
factory_bot_rails provides Rails integration for [factory_bot][fb].

Currently, automatic factory definition loading is the only Rails-specific feature.

Expand All @@ -17,19 +17,19 @@ Ruby versions are listed in [`.travis.yml`](.travis.yml).

## Download

Github: http://github.com/thoughtbot/factory_girl_rails
Github: http://github.com/thoughtbot/factory_bot_rails

Gem:

$ gem install factory_girl_rails
$ gem install factory_bot_rails

## Configuration

Add `factory_girl_rails` to your Gemfile:
Add `factory_bot_rails` to your Gemfile:

```ruby
group :development, :test do
gem 'factory_girl_rails'
gem 'factory_bot_rails'
end
```

Expand All @@ -39,7 +39,7 @@ following to your application.rb file:

```ruby
config.generators do |g|
g.factory_girl false
g.factory_bot false
end
```

Expand All @@ -48,47 +48,47 @@ Default factories directory is `test/factories`, or `spec/factories` if

```ruby
config.generators do |g|
g.factory_girl dir: 'custom/dir/for/factories'
g.factory_bot dir: 'custom/dir/for/factories'
end
```

If you use factory_girl for fixture replacement, ensure that
factory_girl_rails is available in the development group. If it's not, Rails
If you use factory_bot for fixture replacement, ensure that
factory_bot_rails is available in the development group. If it's not, Rails
will generate standard .yml files instead of factory files.

factory_girl takes an option `suffix: 'some_suffix'` to generate factories as
factory_bot takes an option `suffix: 'some_suffix'` to generate factories as
`modelname_some_suffix.rb`.

If you use factory_girl for fixture replacement and already have a
If you use factory_bot for fixture replacement and already have a
`factories.rb` file in the directory that contains your tests,
factory_girl_rails will insert new factory definitions at the top of
factory_bot_rails will insert new factory definitions at the top of
`factories.rb`.

You may need to configure your test suite to include factory_girl methods; see
[configuration](https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#configure-your-test-suite).
You may need to configure your test suite to include factory_bot methods; see
[configuration](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#configure-your-test-suite).

## Contributing

Please see [CONTRIBUTING.md](CONTRIBUTING.md).

## Credits

[factory_girl][fg] was originally written by Joe Ferris.
[factory_bot][fb] was originally written by Joe Ferris.

![thoughtbot](http://thoughtbot.com/images/tm/logo.png)

factory_girl is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
factory_bot is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)

The names and logos for thoughtbot are trademarks of thoughtbot, inc.

## License

factory_girl_rails is Copyright © 2008-2016 Joe Ferris and thoughtbot. It is free
factory_bot_rails is Copyright © 2008-2016 Joe Ferris and thoughtbot. It is free
software, and may be redistributed under the terms specified in the
[LICENSE](LICENSE) file.

[fg]: https://github.com/thoughtbot/factory_girl
[ci]: http://travis-ci.org/thoughtbot/factory_girl_rails?branch=master
[ci-image]: https://secure.travis-ci.org/thoughtbot/factory_girl_rails.png
[grade]: https://codeclimate.com/github/thoughtbot/factory_girl_rails
[grade-image]: https://codeclimate.com/github/thoughtbot/factory_girl_rails.png
[fb]: https://github.com/thoughtbot/factory_bot
[ci]: http://travis-ci.org/thoughtbot/factory_bot_rails?branch=master
[ci-image]: https://secure.travis-ci.org/thoughtbot/factory_bot_rails.png
[grade]: https://codeclimate.com/github/thoughtbot/factory_bot_rails
[grade-image]: https://codeclimate.com/github/thoughtbot/factory_bot_rails.png
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'cucumber/rake/task'

Bundler::GemHelper.install_tasks name: 'factory_bot_rails'

Cucumber::Rake::Task.new(:cucumber) do |t|
t.fork = true
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
Expand Down
20 changes: 20 additions & 0 deletions factory_bot_rails.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Gem::Specification.new do |s|
s.name = %q{factory_bot_rails}
s.version = '4.8.0'
s.authors = ["Joe Ferris"]
s.email = %q{[email protected]}
s.homepage = "http://github.com/thoughtbot/factory_bot_rails"
s.summary = %q{factory_bot_rails provides integration between
factory_bot and rails 3 or newer}
s.description = %q{factory_bot_rails provides integration between
factory_bot and rails 3 or newer (currently just automatic factory definition
loading)}

s.files = Dir['**/*'].keep_if { |file| File.file?(file) }
s.require_paths = ["lib"]
s.executables = []
s.license = "MIT"

s.add_runtime_dependency('railties', '>= 3.0.0')
s.add_runtime_dependency('factory_bot', '~> 4.8.2')
end
2 changes: 1 addition & 1 deletion factory_girl_rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Gem::Specification.new do |s|
s.license = "MIT"

s.add_runtime_dependency('railties', '>= 3.0.0')
s.add_runtime_dependency('factory_girl', '~> 4.8.0')
s.add_runtime_dependency('factory_girl', '~> 4.8.2')
end
36 changes: 18 additions & 18 deletions features/fixture_replacement_config.feature
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
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.
In order to not have to manually configure Factory Bot as the Rails testing fixture replacement by using the --fixture-replacement=factory_bot option
I would like the Factory Bot Rails gem to configure Factory Bot 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 add "factory_bot_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
Scenario: Using Factory Bot and Factory Bot 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
Scenario: Using Factory Bot and Factory Bot 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
g.fixture_replacement :factory_bot
end
"""
And I run `bundle install` with a clean environment
Expand All @@ -32,13 +32,13 @@ Feature:
And the following files should not exist:
| spec/fixtures/users.yml |

Scenario: Using Factory Girl and Factory Girl Rails with RSpec and suffix configuration should generate a factory file with suffix
Scenario: Using Factory Bot and Factory Bot Rails with RSpec and suffix configuration should generate a factory file with suffix
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, suffix: 'factory'
g.fixture_replacement :factory_bot, suffix: 'factory'
end
"""
And I run `bundle install` with a clean environment
Expand All @@ -49,7 +49,7 @@ Feature:
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
Scenario: Using Factory Bot and Factory Bot 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
Expand All @@ -61,7 +61,7 @@ Feature:
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
Scenario: Using Factory Bot and Factory Bot 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
Expand All @@ -71,15 +71,15 @@ Feature:
But the following files should exist:
| custom/dir/users.rb |

Scenario: Using Factory Girl Rails with MiniTest should generate a factory file
Scenario: Using Factory Bot 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
Scenario: Using Factory Bot 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
Expand All @@ -88,11 +88,11 @@ Feature:
But the following files should not exist:
| spec/fixtures/users.yml |

Scenario: Disable Factory Girl generator
Scenario: Disable Factory Bot generator
When I configure the factories as:
"""
config.generators do |g|
g.factory_girl false
g.factory_bot false
end
"""
And I run `bundle install` with a clean environment
Expand All @@ -101,12 +101,12 @@ Feature:
| test/factories/users.rb |
| spec/factories/users.rb |

Scenario: Use a suffix with the Factory Girl generator
Scenario: Use a suffix with the Factory Bot generator
When I add "rspec-rails" as a dependency
When I configure the factories as:
"""
config.generators do |g|
g.factory_girl suffix: 'suffix'
g.factory_bot suffix: 'suffix'
end
"""
And I run `bundle install` with a clean environment
Expand All @@ -116,12 +116,12 @@ Feature:
Then the following files should not exist:
| spec/factories/users.rb |

Scenario: Use a filename_proc with the Factory Girl generator
Scenario: Use a filename_proc with the Factory Bot generator
When I add "rspec-rails" as a dependency
When I configure the factories as:
"""
config.generators do |g|
g.factory_girl filename_proc: Proc.new { |tb| "prefix_#{tb.singularize}_suffix" }
g.factory_bot filename_proc: Proc.new { |tb| "prefix_#{tb.singularize}_suffix" }
end
"""
And I run `bundle install` with a clean environment
Expand Down
Loading

0 comments on commit c5d1151

Please sign in to comment.