Skip to content

Commit

Permalink
Replace FactoryGirl with FactroyBot
Browse files Browse the repository at this point in the history
FactoryGirl was recently renamed to FactoryBot, and we should of course switch to keep getting updates.
  • Loading branch information
navro committed Mar 24, 2018
1 parent 3dca883 commit b29e6f7
Show file tree
Hide file tree
Showing 51 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ group :development, :test do
gem 'capistrano-rbenv', require: false
gem 'capistrano-passenger', require: false
gem 'capybara'
gem 'factory_girl_rails'
gem 'factory_bot_rails'
gem 'dotenv-rails'
gem 'poltergeist'
gem 'pry-byebug'
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ GEM
erubi (1.7.1)
erubis (2.7.0)
execjs (2.7.0)
factory_girl (4.8.0)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
factory_bot_rails (4.8.2)
factory_bot (~> 4.8.2)
railties (>= 3.0.0)
ffi (1.9.23)
font-awesome-rails (4.7.0.3)
Expand Down Expand Up @@ -483,7 +483,7 @@ DEPENDENCIES
devise_token_auth
dotenv-rails
ejs
factory_girl_rails
factory_bot_rails
font-awesome-rails
foreman
fotoramajs
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/tests_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ namespace :db do
start_date: Time.zone.now, category: 'Nollning', end_date: Time.zone.now + 10.hours)

# Documents
FactoryGirl.create(:document)
FactoryGirl.create(:document)
FactoryBot.create(:document)
FactoryBot.create(:document)

# Categories
Category.find_or_create_by!(title: 'Studier', slug: 'studie')
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/accesses.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :access do
post
door
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/adventure_groups.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :adventure_group do
adventure
group
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/adventures.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :adventure do
title
content { generate(:description) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/albums.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :album do
title
description
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/blog_posts.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :blog_post do
title
preamble { generate(:description) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/cafe_shifts.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :cafe_shift do
pass 1
lv 1
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/cafe_workers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :cafe_worker do
cafe_shift
competition true
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/candidates.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :candidate do |c|
association :election, semester: Post::AUTUMN
association :post, semester: Post::AUTUMN
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/categories.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :category do
title_sv { generate(:title) }
title_en { "#{title_sv} - English" }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/constants.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :constant do
name
value
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/contact_messages.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :contact_message do
skip_create
name 'Hilbert Älg'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/contacts.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :contact do |c|
name 'Spindelmän'
email
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/councils.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :council do
title
url
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/documents.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :document do
title
pdf Rack::Test::UploadedFile.new(File.open('spec/assets/pdf.pdf'))
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/doors.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :door do
title
description
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/election_posts.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :election_post do
election
post
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/elections.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :election do
title
url
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/event_signups.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :event_signup do
event
slots 5
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/event_users.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :event_user do
user
user_type EventSignup::MEMBER
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/events.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :event do
title_sv { generate(:title) }
title_en { generate(:title) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/faq.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :faq do
question { generate(:description) }
answer { generate(:description) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/group_users.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :group_user do
user
group
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/groups.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :group do
name
number { rand(1..100) }
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/images.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :image do
album
photographer { FactoryGirl.create(:user) }
photographer { FactoryBot.create(:user) }
file Rack::Test::UploadedFile.new(File.open('spec/assets/image.jpg'))
filename { generate(:firstname) }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/introductions.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :introduction do
title_sv { generate(:title) }
title_en { "English: #{title_sv}" }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/mail_aliases.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :mail_alias do
username 'mr_boss'
domain 'fsektionen.se'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/main_menu.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :main_menu do
name
index { rand(10..100) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/meetings.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :meeting do
user
start_date { 1.days.from_now }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/menus.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :menu do
name
main_menu
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/news.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :news do
title
content { generate(:description) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/nominations.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :nomination do
name
email
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/notifications.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :notification do
user
seen false
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/page_elements.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :page_element do
page
index { rand(1..10) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/page_images.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :page_image do
page
image Rack::Test::UploadedFile.new(File.open('spec/assets/image.jpg'))
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/pages.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :page do
url
visible { true }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/permission_posts.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :permission_post do
permission
post
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/permissions.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :permission do
subject_class { ['News', 'CafeWork', 'Post', 'Rent', 'Event'].sample }
action { ['read', 'create', 'update', 'manage', 'new'].sample }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/post_users.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :post_user do
post
user
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/posts.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :post do
title
council
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/rents.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do

factory :rent do
user
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/shared.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
sequence(:description) { |n| "This describes the most impressive nr#{n}" }
sequence(:email) { |n| "d.wessman#{n}@fsektionen.se" }
sequence(:lastname, 'A') { |n| "Wessman#{n}" }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/short_links.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :short_link do
link 'my_awesomeshort-link0'
target 'http://randomwebpage.com:80/some/resource/yeah?q=asdf&yeah='
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/tool_rentings.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :tool_renting do
renter 'Adrian Roth'
purpose 'to use'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/tools.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :tool do
title 'Awesome Tool'
description
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/users.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :user do
email
password '12345678'
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/work_posts.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: UTF-8
FactoryGirl.define do
FactoryBot.define do
factory :work_post do
title
description
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")

config.include FactoryGirl::Syntax::Methods
config.include FactoryBot::Syntax::Methods

# Allow for I18n in tests
config.include AbstractController::Translation
Expand Down
4 changes: 2 additions & 2 deletions spec/support/factory_girl.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'factory_girl'
require 'factory_bot'
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.include FactoryBot::Syntax::Methods
end

0 comments on commit b29e6f7

Please sign in to comment.