replaced deprecate FactoryGirl gem with FactoryBot
This commit is contained in:
parent
112edd362c
commit
b9d728f890
18 changed files with 38 additions and 38 deletions
4
Gemfile
4
Gemfile
|
@ -131,8 +131,8 @@ group :development, :test do
|
||||||
# Setting ENV for testing purposes
|
# Setting ENV for testing purposes
|
||||||
gem 'figaro'
|
gem 'figaro'
|
||||||
|
|
||||||
# Use Factory Girl for generating random test data
|
# Use Factory Bot for generating random test data
|
||||||
gem 'factory_girl_rails'
|
gem 'factory_bot_rails'
|
||||||
|
|
||||||
# mock http calls
|
# mock http calls
|
||||||
gem 'webmock'
|
gem 'webmock'
|
||||||
|
|
24
Gemfile.lock
24
Gemfile.lock
|
@ -97,12 +97,12 @@ GEM
|
||||||
composite_primary_keys (10.0.1)
|
composite_primary_keys (10.0.1)
|
||||||
activerecord (~> 5.1.0)
|
activerecord (~> 5.1.0)
|
||||||
concurrent-ruby (1.0.5)
|
concurrent-ruby (1.0.5)
|
||||||
coveralls (0.8.21)
|
coveralls (0.7.1)
|
||||||
json (>= 1.8, < 3)
|
multi_json (~> 1.3)
|
||||||
simplecov (~> 0.14.1)
|
rest-client
|
||||||
term-ansicolor (~> 1.3)
|
simplecov (>= 0.7)
|
||||||
thor (~> 0.19.4)
|
term-ansicolor
|
||||||
tins (~> 1.6)
|
thor
|
||||||
crack (0.4.3)
|
crack (0.4.3)
|
||||||
safe_yaml (~> 1.0.0)
|
safe_yaml (~> 1.0.0)
|
||||||
crass (1.0.3)
|
crass (1.0.3)
|
||||||
|
@ -132,10 +132,10 @@ GEM
|
||||||
erubi (1.7.0)
|
erubi (1.7.0)
|
||||||
eventmachine (1.2.5)
|
eventmachine (1.2.5)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
factory_girl (4.9.0)
|
factory_bot (4.8.2)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
factory_girl_rails (4.9.0)
|
factory_bot_rails (4.8.2)
|
||||||
factory_girl (~> 4.9.0)
|
factory_bot (~> 4.8.2)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
faraday (0.12.2)
|
faraday (0.12.2)
|
||||||
multipart-post (>= 1.2, < 3)
|
multipart-post (>= 1.2, < 3)
|
||||||
|
@ -391,7 +391,7 @@ GEM
|
||||||
shellany (0.0.1)
|
shellany (0.0.1)
|
||||||
simple-rss (1.3.1)
|
simple-rss (1.3.1)
|
||||||
simple_oauth (0.3.1)
|
simple_oauth (0.3.1)
|
||||||
simplecov (0.14.1)
|
simplecov (0.15.1)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
json (>= 1.8, < 3)
|
json (>= 1.8, < 3)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
|
@ -420,7 +420,7 @@ GEM
|
||||||
therubyracer (0.12.3)
|
therubyracer (0.12.3)
|
||||||
libv8 (~> 3.16.14.15)
|
libv8 (~> 3.16.14.15)
|
||||||
ref
|
ref
|
||||||
thor (0.19.4)
|
thor (0.20.0)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tilt (2.0.8)
|
tilt (2.0.8)
|
||||||
tins (1.15.1)
|
tins (1.15.1)
|
||||||
|
@ -496,7 +496,7 @@ DEPENDENCIES
|
||||||
em-websocket
|
em-websocket
|
||||||
eventmachine
|
eventmachine
|
||||||
execjs
|
execjs
|
||||||
factory_girl_rails
|
factory_bot_rails
|
||||||
figaro
|
figaro
|
||||||
github_changelog_generator
|
github_changelog_generator
|
||||||
guard
|
guard
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
sequence :test_group_name do |n|
|
sequence :test_group_name do |n|
|
||||||
"TestGroup#{n}"
|
"TestGroup#{n}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
|
|
||||||
factory :group do
|
factory :group do
|
||||||
name { generate(:test_group_name) }
|
name { generate(:test_group_name) }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
factory :import_job do
|
factory :import_job do
|
||||||
name 'Import::Test'
|
name 'Import::Test'
|
||||||
payload {}
|
payload {}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
factory :link do
|
factory :link do
|
||||||
link_type_id { Link::Type.find_by(name: 'normal').id }
|
link_type_id { Link::Type.find_by(name: 'normal').id }
|
||||||
link_object_source_id { Link::Object.find_by(name: 'Ticket').id }
|
link_object_source_id { Link::Object.find_by(name: 'Ticket').id }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
factory :online_notification do
|
factory :online_notification do
|
||||||
object_lookup_id { ObjectLookup.by_name('Ticket') }
|
object_lookup_id { ObjectLookup.by_name('Ticket') }
|
||||||
type_lookup_id { TypeLookup.by_name('Assigned to you') }
|
type_lookup_id { TypeLookup.by_name('Assigned to you') }
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
sequence :test_role_name do |n|
|
sequence :test_role_name do |n|
|
||||||
"TestRole#{n}"
|
"TestRole#{n}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
|
|
||||||
factory :role do
|
factory :role do
|
||||||
name { generate(:test_role_name) }
|
name { generate(:test_role_name) }
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
sequence :test_scheduler_name do |n|
|
sequence :test_scheduler_name do |n|
|
||||||
"Testscheduler#{n}"
|
"Testscheduler#{n}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
|
|
||||||
factory :scheduler do
|
factory :scheduler do
|
||||||
name { generate(:test_scheduler_name) }
|
name { generate(:test_scheduler_name) }
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
sequence :test_signature_name do |n|
|
sequence :test_signature_name do |n|
|
||||||
"Test signature #{n}"
|
"Test signature #{n}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
factory :signature do
|
factory :signature do
|
||||||
name { generate(:test_signature_name) }
|
name { generate(:test_signature_name) }
|
||||||
body '#{user.firstname} #{user.lastname}'.text2html
|
body '#{user.firstname} #{user.lastname}'.text2html
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
factory :tag do
|
factory :tag do
|
||||||
tag_object_id { Tag::Object.lookup_by_name_and_create('Ticket').id }
|
tag_object_id { Tag::Object.lookup_by_name_and_create('Ticket').id }
|
||||||
tag_item_id { Tag::Item.lookup_by_name_and_create('blub').id }
|
tag_item_id { Tag::Item.lookup_by_name_and_create('blub').id }
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
factory :ticket do
|
factory :ticket do
|
||||||
title 'Test Ticket'
|
title 'Test Ticket'
|
||||||
group { Group.lookup(name: 'Users') }
|
group { Group.lookup(name: 'Users') }
|
||||||
customer { FactoryGirl.create(:customer_user) }
|
customer { FactoryBot.create(:customer_user) }
|
||||||
state { Ticket::State.lookup(name: 'new') }
|
state { Ticket::State.lookup(name: 'new') }
|
||||||
priority { Ticket::Priority.lookup(name: '2 normal') }
|
priority { Ticket::Priority.lookup(name: '2 normal') }
|
||||||
updated_by_id 1
|
updated_by_id 1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
factory :ticket_article, class: Ticket::Article do
|
factory :ticket_article, class: Ticket::Article do
|
||||||
from 'factory-customer-1@example.com'
|
from 'factory-customer-1@example.com'
|
||||||
to 'factory-customer-1@example.com'
|
to 'factory-customer-1@example.com'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
factory :token do
|
factory :token do
|
||||||
user_id { FactoryGirl.create(:user).id }
|
user_id { FactoryBot.create(:user).id }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :token_password_reset, parent: :token do
|
factory :token_password_reset, parent: :token do
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
sequence :email do |n|
|
sequence :email do |n|
|
||||||
"nicole.braun#{n}@zammad.org"
|
"nicole.braun#{n}@zammad.org"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
|
|
||||||
factory :user do
|
factory :user do
|
||||||
login 'nicole.braun'
|
login 'nicole.braun'
|
||||||
|
|
2
spec/factories/vendor/net/ldap/entry.rb
vendored
2
spec/factories/vendor/net/ldap/entry.rb
vendored
|
@ -1,4 +1,4 @@
|
||||||
FactoryGirl.define do
|
FactoryBot.define do
|
||||||
|
|
||||||
# add custom attributes via:
|
# add custom attributes via:
|
||||||
# mocked_entry = build(:ldap_entry)
|
# mocked_entry = build(:ldap_entry)
|
||||||
|
|
3
spec/support/factory_bot.rb
Normal file
3
spec/support/factory_bot.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.include FactoryBot::Syntax::Methods
|
||||||
|
end
|
|
@ -1,3 +0,0 @@
|
||||||
RSpec.configure do |config|
|
|
||||||
config.include FactoryGirl::Syntax::Methods
|
|
||||||
end
|
|
|
@ -3,7 +3,7 @@ RSpec.configure do |config|
|
||||||
|
|
||||||
email = 'admin@example.com'
|
email = 'admin@example.com'
|
||||||
if !::User.exists?(email: email)
|
if !::User.exists?(email: email)
|
||||||
FactoryGirl.create(:user,
|
FactoryBot.create(:user,
|
||||||
login: 'admin',
|
login: 'admin',
|
||||||
firstname: 'Admin',
|
firstname: 'Admin',
|
||||||
lastname: 'Admin',
|
lastname: 'Admin',
|
||||||
|
|
Loading…
Reference in a new issue