Skip to content

Commit

Permalink
Updated FactoryBot gem (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Bazhanov authored Dec 11, 2019
1 parent 87d36f2 commit bb46e35
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 23 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

1. Fork the project.
2. Setup it on your machine with `bin/setup`.
3. Make sure the tests pass: `bin/ci`.
4. Make your change. Add tests for your change when necessary. Make the tests pass: `bin/ci`.
3. Make sure the tests pass: `bin/test`.
4. Make your change. Add tests for your change when necessary. Make the tests pass: `bin/test`.
5. Mention your changes in "Unreleased" section of `CHANGELOG.md`
6. Push to your fork and [submit a pull request](https://help.github.com/articles/creating-a-pull-request/)
(bonus points for topic branches).
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,10 @@ group :development, :test do
gem "byebug"
gem "coffeelint"
gem "dotenv-rails"
gem "factory_girl_rails"
gem "factory_bot_rails"
gem "faker"
gem "jasmine", "> 2.0"
gem "jasmine-jquery-rails"
gem "pry-rails"
gem "rspec-rails", "~> 3.5"
gem "rubocop", require: false
gem "rubocop-rspec", require: false
Expand Down
15 changes: 6 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ GEM
mail (~> 2.6.3)
erubi (1.9.0)
execjs (2.7.0)
factory_girl (4.8.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
railties (>= 3.0.0)
factory_bot (5.1.1)
activesupport (>= 4.2.0)
factory_bot_rails (5.1.1)
factory_bot (~> 5.1.0)
railties (>= 4.2.0)
faker (1.7.3)
i18n (~> 0.5)
ffi (1.9.25)
Expand Down Expand Up @@ -256,8 +256,6 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-rails (0.3.5)
pry (>= 0.9.10)
public_suffix (4.0.1)
puma (3.12.2)
pundit (1.1.0)
Expand Down Expand Up @@ -455,7 +453,7 @@ DEPENDENCIES
dotenv-rails
draper
email_spec
factory_girl_rails
factory_bot_rails
faker
flamegraph
formulaic
Expand All @@ -477,7 +475,6 @@ DEPENDENCIES
pg
poltergeist
premailer-rails
pry-rails
puma
pundit
rack-canonical-host
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ It's based on Rails 5 and Ruby 2.5
* [Rubocop](https://github.com/bbatsov/rubocop) and [Rubocop-Rspec](https://github.com/nevir/rubocop-rspec)
for reporting violations of the Ruby style guide
* [Brakeman](https://github.com/presidentbeef/brakeman) for checking application for common security vulnerabilities
* [Pry Rails](https://github.com/rweng/pry-rails) for interactively exploring objects
* [ByeBug](https://github.com/deivid-rodriguez/byebug) as debugger
* [Bundler Audit](https://github.com/rubysec/bundler-audit) for scanning the Gemfile for
insecure dependencies based on published CVEs
* [Spring](https://github.com/rails/spring) for fast Rails actions via
Expand All @@ -50,7 +50,7 @@ It's based on Rails 5 and Ruby 2.5
* [Jasmine](http://jasmine.github.io/) for unit testing JavaScript code
* [Jasmine jQuery](https://github.com/velesin/jasmine-jquery) for jQuery matchers and
fixtures in Jasmine
* [Factory Girl](https://github.com/thoughtbot/factory_girl) for test data
* [Factory Bot](https://github.com/thoughtbot/factory_bot_rails) for test data
* [RSpec](https://github.com/rspec/rspec) for unit testing
* [Shoulda Matchers](http://github.com/thoughtbot/shoulda-matchers) for common RSpec matchers
* [Email Spec](https://github.com/bmabey/email-spec) for common matchers for testing emails
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/generators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
g.stylesheets false
g.helper false
g.integration_tool false
g.fixture_replacement(:factory_girl, dir: "spec/factories")
g.fixture_replacement(:factory_bot, dir: "spec/factories")
g.test_framework(
:rspec,
controller_specs: false,
Expand Down
2 changes: 1 addition & 1 deletion db/seeds/development/all.seeds.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FactoryGirl.create(:user, email: "[email protected]")
FactoryBot.create(:user, email: "[email protected]")
2 changes: 1 addition & 1 deletion spec/factories/sequences.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
sequence(:email) { Faker::Internet.email }
sequence(:title) { |n| "#{Faker::Lorem.words} #{n}" }
end
8 changes: 4 additions & 4 deletions spec/factories/users.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FactoryGirl.define do
FactoryBot.define do
factory :user do
email
full_name { Faker::Name.name }
password "123456"
password { "123456" }
password_confirmation { password }
confirmed_at 1.hour.ago
confirmed_at { 1.hour.ago }
end

trait :not_confirmed do
confirmed_at nil
confirmed_at { nil }

after(:create) do |user|
user.update(confirmation_sent_at: 3.days.ago)
Expand Down
2 changes: 1 addition & 1 deletion spec/support/factory_girl.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.include FactoryBot::Syntax::Methods
end

0 comments on commit bb46e35

Please sign in to comment.