replaced deprecate FactoryGirl gem with FactoryBot

This commit is contained in:
André Bauer 2017-11-21 22:50:03 +01:00
parent 112edd362c
commit b9d728f890
18 changed files with 38 additions and 38 deletions

View file

@ -131,8 +131,8 @@ group :development, :test do
# Setting ENV for testing purposes
gem 'figaro'
# Use Factory Girl for generating random test data
gem 'factory_girl_rails'
# Use Factory Bot for generating random test data
gem 'factory_bot_rails'
# mock http calls
gem 'webmock'

View file

@ -97,12 +97,12 @@ GEM
composite_primary_keys (10.0.1)
activerecord (~> 5.1.0)
concurrent-ruby (1.0.5)
coveralls (0.8.21)
json (>= 1.8, < 3)
simplecov (~> 0.14.1)
term-ansicolor (~> 1.3)
thor (~> 0.19.4)
tins (~> 1.6)
coveralls (0.7.1)
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
term-ansicolor
thor
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.3)
@ -132,10 +132,10 @@ GEM
erubi (1.7.0)
eventmachine (1.2.5)
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)
faraday (0.12.2)
multipart-post (>= 1.2, < 3)
@ -391,7 +391,7 @@ GEM
shellany (0.0.1)
simple-rss (1.3.1)
simple_oauth (0.3.1)
simplecov (0.14.1)
simplecov (0.15.1)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
@ -420,7 +420,7 @@ GEM
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (0.19.4)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
tins (1.15.1)
@ -496,7 +496,7 @@ DEPENDENCIES
em-websocket
eventmachine
execjs
factory_girl_rails
factory_bot_rails
figaro
github_changelog_generator
guard

View file

@ -1,10 +1,10 @@
FactoryGirl.define do
FactoryBot.define do
sequence :test_group_name do |n|
"TestGroup#{n}"
end
end
FactoryGirl.define do
FactoryBot.define do
factory :group do
name { generate(:test_group_name) }

View file

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :import_job do
name 'Import::Test'
payload {}

View file

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :link do
link_type_id { Link::Type.find_by(name: 'normal').id }
link_object_source_id { Link::Object.find_by(name: 'Ticket').id }

View file

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :online_notification do
object_lookup_id { ObjectLookup.by_name('Ticket') }
type_lookup_id { TypeLookup.by_name('Assigned to you') }

View file

@ -1,10 +1,10 @@
FactoryGirl.define do
FactoryBot.define do
sequence :test_role_name do |n|
"TestRole#{n}"
end
end
FactoryGirl.define do
FactoryBot.define do
factory :role do
name { generate(:test_role_name) }

View file

@ -1,10 +1,10 @@
FactoryGirl.define do
FactoryBot.define do
sequence :test_scheduler_name do |n|
"Testscheduler#{n}"
end
end
FactoryGirl.define do
FactoryBot.define do
factory :scheduler do
name { generate(:test_scheduler_name) }

View file

@ -1,10 +1,10 @@
FactoryGirl.define do
FactoryBot.define do
sequence :test_signature_name do |n|
"Test signature #{n}"
end
end
FactoryGirl.define do
FactoryBot.define do
factory :signature do
name { generate(:test_signature_name) }
body '#{user.firstname} #{user.lastname}'.text2html

View file

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :tag do
tag_object_id { Tag::Object.lookup_by_name_and_create('Ticket').id }
tag_item_id { Tag::Item.lookup_by_name_and_create('blub').id }

View file

@ -1,8 +1,8 @@
FactoryGirl.define do
FactoryBot.define do
factory :ticket do
title 'Test Ticket'
group { Group.lookup(name: 'Users') }
customer { FactoryGirl.create(:customer_user) }
customer { FactoryBot.create(:customer_user) }
state { Ticket::State.lookup(name: 'new') }
priority { Ticket::Priority.lookup(name: '2 normal') }
updated_by_id 1

View file

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :ticket_article, class: Ticket::Article do
from 'factory-customer-1@example.com'
to 'factory-customer-1@example.com'

View file

@ -1,6 +1,6 @@
FactoryGirl.define do
FactoryBot.define do
factory :token do
user_id { FactoryGirl.create(:user).id }
user_id { FactoryBot.create(:user).id }
end
factory :token_password_reset, parent: :token do

View file

@ -1,10 +1,10 @@
FactoryGirl.define do
FactoryBot.define do
sequence :email do |n|
"nicole.braun#{n}@zammad.org"
end
end
FactoryGirl.define do
FactoryBot.define do
factory :user do
login 'nicole.braun'

View file

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
# add custom attributes via:
# mocked_entry = build(:ldap_entry)

View file

@ -0,0 +1,3 @@
RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
end

View file

@ -1,3 +0,0 @@
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end

View file

@ -3,7 +3,7 @@ RSpec.configure do |config|
email = 'admin@example.com'
if !::User.exists?(email: email)
FactoryGirl.create(:user,
FactoryBot.create(:user,
login: 'admin',
firstname: 'Admin',
lastname: 'Admin',