Skip to content

Commit

Permalink
Merge pull request #434 from codeforamerica/mb-update-factory-bot
Browse files Browse the repository at this point in the history
Replace factory_girl with factory_bot
  • Loading branch information
monfresh committed Dec 24, 2017
2 parents d198bf8 + b9e8d02 commit f273f8d
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -37,7 +37,7 @@ end

group :test, :development do
gem 'bullet'
gem 'factory_girl_rails', '>= 4.2.0'
gem 'factory_bot_rails'
gem 'rspec-its'
gem 'rspec-rails', '~> 3.1'
gem 'smarter_csv'
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Expand Up @@ -130,10 +130,10 @@ GEM
erubi (1.7.0)
erubis (2.7.0)
execjs (2.7.0)
factory_girl (4.9.0)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
factory_bot_rails (4.8.2)
factory_bot (~> 4.8.2)
railties (>= 3.0.0)
ffi (1.9.14)
figaro (1.1.1)
Expand Down Expand Up @@ -400,7 +400,7 @@ DEPENDENCIES
derailed
devise (~> 4.1)
enumerize
factory_girl_rails (>= 4.2.0)
factory_bot_rails
figaro (~> 1.0)
flamegraph
friendly_id (~> 5.0)
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/api_applications_controller_spec.rb
Expand Up @@ -2,7 +2,7 @@

describe ApiApplicationsController do
before :each do
@user = FactoryGirl.create(:user)
@user = FactoryBot.create(:user)
sign_in @user
end
# This should return the minimal set of attributes required to create a valid
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/addresses.rb
@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
FactoryBot.define do
factory :address do
address_1 '1800 Easton Drive'
city 'Burlingame'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/admins.rb
@@ -1,5 +1,5 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :admin do
name 'Org Admin'
email 'moncef@samaritanhouse.com'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/api_applications.rb
@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
FactoryBot.define do
factory :api_application do
name 'test app'
main_url 'http://cfa.org'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/categories.rb
@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
FactoryBot.define do
factory :category do
name 'Food'
taxonomy_id '101'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/contacts.rb
@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
FactoryBot.define do
factory :contact do
name 'Moncef Belyamani'
title 'CTO'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/holiday_schedules.rb
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :holiday_schedule do
closed true
start_date 'December 24, 2014'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/locations.rb
@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
FactoryBot.define do
factory :location do
name 'VRS Services'
description 'Provides jobs training'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/mail_addresses.rb
@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
FactoryBot.define do
factory :mail_address do
attention 'Monfresh'
address_1 '1 davis dr'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/organizations.rb
@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
FactoryBot.define do
factory :organization do
name 'Parent Agency'
description 'Organization created for testing purposes'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/phones.rb
@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
FactoryBot.define do
factory :phone do
number '650 851-1210'
number_type 'voice'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/programs.rb
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :program do
name 'Collection of Services '
alternate_name ' Also Known As'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/regular_schedules.rb
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :regular_schedule do
weekday 7
opens_at '9:30'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/services.rb
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :service do
name 'Literacy Program'
description 'yoga classes'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/users.rb
@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
FactoryBot.define do
factory :user do
name 'Test User'
email 'valid@example.com'
Expand Down
2 changes: 1 addition & 1 deletion spec/features/create_new_api_application_spec.rb
Expand Up @@ -14,7 +14,7 @@
# All other methods are part of the Capybara DSL
# https://github.com/jnicklas/capybara
background do
user = FactoryGirl.create(:user)
user = FactoryBot.create(:user)
login_as(user, scope: :user)
visit '/api_applications'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/delete_api_application_spec.rb
Expand Up @@ -2,7 +2,7 @@

feature 'Delete an API Application' do
background do
user = FactoryGirl.create(:user_with_app)
user = FactoryBot.create(:user_with_app)
login_as(user, scope: :user)
name = user.api_applications.first.name
main_url = user.api_applications.first.main_url
Expand Down
2 changes: 1 addition & 1 deletion spec/features/homepage_text_spec.rb
Expand Up @@ -11,7 +11,7 @@
# All other methods are part of the Capybara DSL
# https://github.com/jnicklas/capybara
background do
user = FactoryGirl.create(:user)
user = FactoryBot.create(:user)
login_as(user, scope: :user)
visit '/'
end
Expand Down
4 changes: 2 additions & 2 deletions spec/features/signin_spec.rb
Expand Up @@ -4,7 +4,7 @@
# The 'sign_in' method is defined in spec/support/features/session_helpers.rb
context 'with correct credentials' do
before :each do
valid_user = FactoryGirl.create(:user)
valid_user = FactoryBot.create(:user)
sign_in(valid_user.email, valid_user.password)
end

Expand All @@ -27,7 +27,7 @@
end

scenario 'with an unconfirmed user' do
unconfirmed_user = FactoryGirl.create(:unconfirmed_user)
unconfirmed_user = FactoryBot.create(:unconfirmed_user)
sign_in(unconfirmed_user.email, unconfirmed_user.password)
expect(page).
to have_content 'You have to confirm your account before continuing.'
Expand Down
2 changes: 1 addition & 1 deletion spec/features/update_api_application_spec.rb
Expand Up @@ -14,7 +14,7 @@
# All other methods are part of the Capybara DSL
# https://github.com/jnicklas/capybara
background do
user = FactoryGirl.create(:user_with_app)
user = FactoryBot.create(:user_with_app)
login_as(user, scope: :user)
name = user.api_applications.first.name
main_url = user.api_applications.first.main_url
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Expand Up @@ -35,7 +35,7 @@
ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.include FactoryBot::Syntax::Methods
config.include Features::SessionHelpers, type: :feature
config.include Features::FormHelpers, type: :feature
config.include Features::ScheduleHelpers, type: :feature
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/api_applications_spec.rb
Expand Up @@ -13,7 +13,7 @@

context 'when signed in' do
it 'returns a 200' do
@user = FactoryGirl.create(:user)
@user = FactoryBot.create(:user)
login(@user)
get api_applications_path
expect(response.status).to be(200)
Expand Down
2 changes: 1 addition & 1 deletion spec/support/admin/controller_helpers.rb
@@ -1,6 +1,6 @@
module ControllerHelpers
def log_in_as_admin(admin)
@request.env['devise.mapping'] = Devise.mappings[:admin]
sign_in FactoryGirl.create(admin)
sign_in FactoryBot.create(admin)
end
end
6 changes: 3 additions & 3 deletions spec/support/features/session_helpers.rb
Expand Up @@ -3,7 +3,7 @@ module Features
# repetitive actions.
module SessionHelpers
def login_admin
@admin = FactoryGirl.create(:admin)
@admin = FactoryBot.create(:admin)
login_as(@admin, scope: :admin)
end

Expand All @@ -12,12 +12,12 @@ def login_as_admin(admin)
end

def login_super_admin
@super_admin = FactoryGirl.create(:super_admin)
@super_admin = FactoryBot.create(:super_admin)
login_as(@super_admin, scope: :admin)
end

def login_user
@user = FactoryGirl.create(:user)
@user = FactoryBot.create(:user)
login_as(@user, scope: :user)
end

Expand Down

0 comments on commit f273f8d

Please sign in to comment.