Merge pull request #6304 from opf/housekeeping/bump-factory-girl

FactoryGirl => FactoryBot
pull/6310/head
ulferts 7 years ago committed by GitHub
commit 189fd8a2f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      Gemfile
  2. 10
      Gemfile.lock
  3. 4
      app/seeders/development_data/custom_fields_seeder.rb
  4. 6
      app/seeders/root_seeder.rb
  5. 4
      features/step_definitions/board_steps.rb
  6. 2
      features/step_definitions/common_steps.rb
  7. 2
      features/step_definitions/custom_field_steps.rb
  8. 26
      features/step_definitions/general_steps.rb
  9. 6
      features/step_definitions/group_steps.rb
  10. 4
      features/step_definitions/issue_category_steps.rb
  11. 10
      features/step_definitions/issue_steps.rb
  12. 4
      features/step_definitions/priority_steps.rb
  13. 2
      features/step_definitions/project_steps.rb
  14. 4
      features/step_definitions/query_steps.rb
  15. 2
      features/step_definitions/repository_steps.rb
  16. 6
      features/step_definitions/role_steps.rb
  17. 2
      features/step_definitions/search_steps.rb
  18. 2
      features/step_definitions/status_steps.rb
  19. 4
      features/step_definitions/time_entry_steps.rb
  20. 2
      features/step_definitions/type_steps.rb
  21. 4
      features/step_definitions/user_steps.rb
  22. 2
      features/step_definitions/version_steps.rb
  23. 16
      features/step_definitions/wiki_steps.rb
  24. 2
      features/step_definitions/work_package_changesets_steps.rb
  25. 2
      features/step_definitions/work_package_steps.rb
  26. 6
      features/support/env.rb
  27. 4
      lib/open_project/plugins/acts_as_op_engine.rb
  28. 4
      spec/contracts/custom_actions/cu_contract_spec.rb
  29. 6
      spec/contracts/relations/create_contract_spec.rb
  30. 6
      spec/contracts/users/create_contract_spec.rb
  31. 36
      spec/contracts/work_packages/base_contract_spec.rb
  32. 6
      spec/contracts/work_packages/create_contract_spec.rb
  33. 4
      spec/contracts/work_packages/create_note_contract_spec.rb
  34. 6
      spec/contracts/work_packages/shared_base_contract.rb
  35. 18
      spec/contracts/work_packages/update_contract_spec.rb
  36. 20
      spec/controllers/account_controller_spec.rb
  37. 26
      spec/controllers/activities_controller_spec.rb
  38. 2
      spec/controllers/announcements_controller_spec.rb
  39. 4
      spec/controllers/application_controller_spec.rb
  40. 16
      spec/controllers/attachments_controller_spec.rb
  41. 2
      spec/controllers/attribute_help_texts_controller_spec.rb
  42. 10
      spec/controllers/auth_sources_controller_spec.rb
  43. 22
      spec/controllers/boards_controller_spec.rb
  44. 18
      spec/controllers/categories_controller_spec.rb
  45. 8
      spec/controllers/concerns/auth_source_sso_spec.rb
  46. 2
      spec/controllers/concerns/omniauth_login_spec.rb
  47. 4
      spec/controllers/concerns/user_invitation_spec.rb
  48. 6
      spec/controllers/copy_projects_controller_spec.rb
  49. 6
      spec/controllers/custom_actions_controller_spec.rb
  50. 2
      spec/controllers/custom_fields_controller_spec.rb
  51. 26
      spec/controllers/custom_styles_controller_spec.rb
  52. 4
      spec/controllers/enterprises_controller_spec.rb
  53. 6
      spec/controllers/enumerations_controller.rb
  54. 8
      spec/controllers/homescreen_controller_spec.rb
  55. 12
      spec/controllers/journals_controller_spec.rb
  56. 2
      spec/controllers/ldap_auth_sources_controller_spec.rb
  57. 32
      spec/controllers/members_controller_spec.rb
  58. 26
      spec/controllers/messages_controller_spec.rb
  59. 4
      spec/controllers/my_controller_spec.rb
  60. 6
      spec/controllers/news/comments_controller_spec.rb
  61. 8
      spec/controllers/news_controller_spec.rb
  62. 14
      spec/controllers/planning_element_type_colors_controller_spec.rb
  63. 14
      spec/controllers/project_types_controller_spec.rb
  64. 40
      spec/controllers/projects_controller_spec.rb
  65. 32
      spec/controllers/repositories_controller_spec.rb
  66. 16
      spec/controllers/search_controller_spec.rb
  67. 2
      spec/controllers/settings_controller_spec.rb
  68. 10
      spec/controllers/statuses_controller_spec.rb
  69. 52
      spec/controllers/sys_controller_spec.rb
  70. 10
      spec/controllers/timelog_controller_spec.rb
  71. 40
      spec/controllers/types_controller_spec.rb
  72. 10
      spec/controllers/users/memberships_controller_spec.rb
  73. 42
      spec/controllers/users_controller_spec.rb
  74. 14
      spec/controllers/versions_controller_spec.rb
  75. 50
      spec/controllers/wiki_controller_spec.rb
  76. 12
      spec/controllers/wiki_menu_authentication_spec.rb
  77. 30
      spec/controllers/wiki_menu_items_controller_spec.rb
  78. 22
      spec/controllers/work_packages/auto_completes_controller_spec.rb
  79. 56
      spec/controllers/work_packages/bulk_controller_spec.rb
  80. 10
      spec/controllers/work_packages/calendars_controller_spec.rb
  81. 40
      spec/controllers/work_packages/moves_controller_spec.rb
  82. 14
      spec/controllers/work_packages/reports_controller_spec.rb
  83. 12
      spec/controllers/work_packages_controller_spec.rb
  84. 6
      spec/decorators/single_spec.rb
  85. 2
      spec/factories/announcement_factory.rb
  86. 2
      spec/factories/attachment_factory.rb
  87. 2
      spec/factories/attribute_help_text_factory.rb
  88. 2
      spec/factories/auth_source_factory.rb
  89. 2
      spec/factories/board_factory.rb
  90. 2
      spec/factories/category_factory.rb
  91. 2
      spec/factories/changeset_factory.rb
  92. 2
      spec/factories/comment_factory.rb
  93. 2
      spec/factories/custom_action_factory.rb
  94. 2
      spec/factories/custom_field_factory.rb
  95. 2
      spec/factories/custom_option_factory.rb
  96. 2
      spec/factories/custom_style_factory.rb
  97. 2
      spec/factories/custom_value_factory.rb
  98. 4
      spec/factories/design_color_factory.rb
  99. 2
      spec/factories/enumerations_factory.rb
  100. 4
      spec/factories/file_factory.rb
  101. Some files were not shown because too many files have changed in this diff Show More

@ -178,12 +178,12 @@ group :test do
gem 'shoulda-context', '~> 1.2'
gem 'launchy', '~> 2.4.3'
# Require factory_girl for usage with openproject plugins testing
# FactoryGirl needs to be available when loading app otherwise factory
# Require factory_bot for usage with openproject plugins testing
# FactoryBot needs to be available when loading app otherwise factory
# definitions from core are not available in the plugin thus specs break
gem 'factory_girl', '~> 4.5'
# require factory_girl_rails for convenience in core development
gem 'factory_girl_rails', '~> 4.7', require: false
gem 'factory_bot', '~> 4.8'
# require factory_bot_rails for convenience in core development
gem 'factory_bot_rails', '~> 4.8', require: false
# Test prof provides factories from code
# and other niceties

@ -263,10 +263,10 @@ GEM
eventmachine (1.2.5)
excon (0.52.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)
faker (1.8.4)
i18n (~> 0.5)
@ -654,8 +654,8 @@ DEPENDENCIES
date_validator (~> 0.9.0)
delayed_job_active_record (~> 4.1.1)
equivalent-xml (~> 0.6)
factory_girl (~> 4.5)
factory_girl_rails (~> 4.7)
factory_bot (~> 4.8)
factory_bot_rails (~> 4.8)
faker
fog-aws
friendly_id (~> 5.2.1)

@ -46,14 +46,14 @@ module DevelopmentData
def create_types!(cfs)
# Create ALL CFs types
non_req_cfs = cfs.reject(&:is_required).map { |cf| "custom_field_#{cf.id}" }
type = FactoryGirl.build :type_with_workflow, name: 'All CFS'
type = FactoryBot.build :type_with_workflow, name: 'All CFS'
extend_group(type, ['Custom fields', non_req_cfs])
type.save!
print '.'
# Create type
req_cfs = cfs.select(&:is_required).map { |cf| "custom_field_#{cf.id}" }
type_req = FactoryGirl.build :type_with_workflow, name: 'Required CF'
type_req = FactoryBot.build :type_with_workflow, name: 'Required CF'
extend_group(type_req, ['Custom fields', req_cfs])
type_req.save!
print '.'

@ -63,9 +63,9 @@ class RootSeeder < Seeder
if Rails.env.development?
puts '*** Seeding development data'
require 'factory_girl'
# Load FactoryGirl factories
::FactoryGirl.find_definitions
require 'factory_bot'
# Load FactoryBot factories
::FactoryBot.find_definitions
DevelopmentDataSeeder.new.seed!
end

@ -28,7 +28,7 @@
#++
Given(/^there is a board "(.*?)" for project "(.*?)"$/) do |board_name, project_identifier|
FactoryGirl.create :board, project: get_project(project_identifier), name: board_name
FactoryBot.create :board, project: get_project(project_identifier), name: board_name
end
Given(/^the board "(.*?)" has the following messages:$/) do |board_name, table|
@ -47,7 +47,7 @@ private
def create_messages(names, board, parent = nil)
names.each do |name|
FactoryGirl.create :message,
FactoryBot.create :message,
board: board,
subject: name,
parent: parent

@ -44,7 +44,7 @@ Given /^the [pP]roject(?: "([^\"]+?)")? uses the following types:$/ do |project,
name = line.first
type = ::Type.find_by(name: name)
type = FactoryGirl.create(:type, name: name) if type.blank?
type = FactoryBot.create(:type, name: name) if type.blank?
type
}

@ -48,7 +48,7 @@ Given /^the following (user|issue|work package) custom fields are defined:$/ do
attr_hash[:default_value] = r[:default_value] ? r[:default_value] : nil
attr_hash[:is_for_all] = r[:is_for_all] || true
FactoryGirl.create type, attr_hash
FactoryBot.create type, attr_hash
end
end
end

@ -32,14 +32,14 @@ require 'rack_session_access/capybara'
Before do |scenario|
unless ScenarioDisabler.empty_if_disabled(scenario)
FactoryGirl.create(:admin) unless User.find_by_login('admin')
FactoryGirl.create(:anonymous) unless AnonymousUser.count > 0
FactoryBot.create(:admin) unless User.find_by_login('admin')
FactoryBot.create(:anonymous) unless AnonymousUser.count > 0
Setting.notified_events = [] # can not test mailer
end
end
Given /^I am logged in$/ do
@user = FactoryGirl.create :user
@user = FactoryBot.create :user
page.set_rack_session(user_id: @user.id, updated_at: Time.now)
end
@ -86,7 +86,7 @@ Given /^(?:|I )am (not )?impaired$/ do |bool|
end
Given /^there is 1 [pP]roject with(?: the following)?:$/ do |table|
p = FactoryGirl.build(:project)
p = FactoryBot.build(:project)
send_table_to_object(p, table)
end
@ -121,8 +121,8 @@ Given /^the [Uu]ser "([^\"]*)" has 1 time [eE]ntry$/ do |user|
u = User.find_by login: user
p = u.projects.last
raise 'This user must be member of a project to have issues' unless p
i = FactoryGirl.create(:work_package, project: p)
t = FactoryGirl.build(:time_entry)
i = FactoryBot.create(:work_package, project: p)
t = FactoryBot.build(:time_entry)
t.user = u
t.issue = i
t.project = p
@ -134,8 +134,8 @@ end
Given /^the [Uu]ser "([^\"]*)" has 1 time entry with (\d+\.?\d*) hours? at the project "([^\"]*)"$/ do |user, hours, project|
p = Project.find_by(name: project) || Project.find_by(identifier: project)
as_admin do
t = FactoryGirl.build(:time_entry)
i = FactoryGirl.create(:work_package, project: p)
t = FactoryBot.build(:time_entry)
i = FactoryBot.create(:work_package, project: p)
t.project = p
t.issue = i
t.hours = hours.to_f
@ -149,8 +149,8 @@ end
Given /^the [Pp]roject "([^\"]*)" has (\d+) [tT]ime(?: )?[eE]ntr(?:ies|y) with the following:$/ do |project, count, table|
p = Project.find_by(name: project) || Project.find_by(identifier: project)
as_admin count do
t = FactoryGirl.build(:time_entry)
i = FactoryGirl.create(:work_package, project: p)
t = FactoryBot.build(:time_entry)
i = FactoryBot.create(:work_package, project: p)
t.project = p
t.work_package = i
t.activity.project = p
@ -173,14 +173,14 @@ end
Given /^the [pP]roject "([^\"]*)" has 1 [sS]ubproject$/ do |project|
parent = Project.find_by(name: project)
p = FactoryGirl.create(:project)
p = FactoryBot.create(:project)
p.set_parent!(parent)
p.save!
end
Given /^the [pP]roject "([^\"]*)" has 1 [sS]ubproject with the following:$/ do |project, table|
parent = Project.find_by(name: project)
p = FactoryGirl.build(:project)
p = FactoryBot.build(:project)
as_admin do
send_table_to_object(p, table)
end
@ -231,7 +231,7 @@ Given /^the [iI]ssue "([^\"]*)" has (\d+) [tT]ime(?: )?[eE]ntr(?:ies|y) with the
i = WorkPackage.where(["subject = '#{issue}'"]).last
raise "No such issue: #{issue}" unless i
as_admin count do
t = FactoryGirl.build(:time_entry)
t = FactoryBot.build(:time_entry)
t.project = i.project
t.spent_on = DateTime.now
t.work_package = i

@ -28,7 +28,7 @@
#++
Given /^there is 1 group with the following:$/ do |table|
group = FactoryGirl.build(:group)
group = FactoryBot.build(:group)
send_table_to_object group, table, name: Proc.new { |group, name| group.lastname = name }
end
@ -63,11 +63,11 @@ When /^I add the user "(.+)" to the group$/ do |user_login|
end
Given /^We have the group "(.*?)"/ do |name|
group = FactoryGirl.create(:group, lastname: name)
group = FactoryBot.create(:group, lastname: name)
end
Given /^there is a group named "(.*?)" with the following members:$/ do |name, table|
group = FactoryGirl.create(:group, lastname: name)
group = FactoryBot.create(:group, lastname: name)
table.raw.flatten.each do |login|
group.users << User.find_by!(login: login)

@ -33,7 +33,7 @@ Given /^the [Pp]roject "([^\"]*)" has (\d+) [cC]ategor(?:ies|y)? with(?: the fol
p = Project.find_by(name: project) || Project.find_by(identifier: project)
table.rows_hash['assigned_to'] = Principal.like(table.rows_hash['assigned_to']).first if table.rows_hash['assigned_to']
as_admin count do
ic = FactoryGirl.build(:category, project: p)
ic = FactoryBot.build(:category, project: p)
send_table_to_object(ic, table)
ic.save
end
@ -42,7 +42,7 @@ end
Given /^the [Pp]roject "([^\"]*)" has (\d+) [cC]ategor(?:ies|y)?$/ do |project, count|
p = Project.find_by(name: project) || Project.find_by(identifier: project)
as_admin count do
ic = FactoryGirl.build(:category, project: p)
ic = FactoryBot.build(:category, project: p)
ic.save
end
end

@ -46,7 +46,7 @@ Given(/^the issue "(.*?)" has an attachment "(.*?)"$/) do |issue_subject, file_n
issue = WorkPackage.where(subject: issue_subject).order(:created_at).last
file = OpenProject::Files.create_temp_file name: file_name,
content: 'random content which is not actually a gif'
attachment = FactoryGirl.create :attachment,
attachment = FactoryBot.create :attachment,
author: issue.author,
content_type: content_type,
file: file,
@ -60,11 +60,11 @@ Given /^the [Uu]ser "([^\"]*)" has (\d+) [iI]ssue(?:s)? with(?: the following)?:
u = User.find_by login: user
raise 'This user must be member of a project to have issues' unless u.projects.last
as_admin count do
i = FactoryGirl.create(:work_package,
i = FactoryBot.create(:work_package,
project: u.projects.last,
author: u,
assigned_to: u,
status: Status.default || FactoryGirl.create(:status))
status: Status.default || FactoryBot.create(:status))
i.type = ::Type.find_by(name: table.rows_hash.delete('type')) if table.rows_hash['type']
@ -76,7 +76,7 @@ end
Given /^the [Pp]roject "([^\"]*)" has (\d+) [iI]ssue(?:s)? with(?: the following)?:$/ do |project, count, table|
p = Project.find_by(name: project) || Project.find_by(identifier: project)
as_admin count do
i = FactoryGirl.build(:work_package, project: p,
i = FactoryBot.build(:work_package, project: p,
type: p.types.first)
send_table_to_object(i, table, {}, method(:add_custom_value_to_issue))
end
@ -121,7 +121,7 @@ Given (/^there are the following issues with attributes:$/) do |table|
category = Category.find_by(name: attributes.delete('category'))
attributes.merge! category_id: category.id if category
issue = FactoryGirl.create(:work_package, attributes)
issue = FactoryBot.create(:work_package, attributes)
if watchers
watchers.split(',').each do |w| issue.add_watcher User.find_by_login(w) end

@ -32,7 +32,7 @@ InstanceFinder.register(IssuePriority, Proc.new { |name| IssuePriority.find_by(n
Given /^there is a(?:n)? (default )?issuepriority with:$/ do |default, table|
name = table.raw.find { |ary| ary.include? 'name' }[table.raw.first.index('name') + 1].to_s
project = get_project
FactoryGirl.build(:priority).tap do |prio|
FactoryBot.build(:priority).tap do |prio|
prio.name = name
prio.is_default = !!default
prio.project = project
@ -43,7 +43,7 @@ Given /^there are the following priorities:$/ do |table|
table.hashes.each do |row|
project = get_project
FactoryGirl.build(:priority).tap do |prio|
FactoryBot.build(:priority).tap do |prio|
prio.name = row[:name]
prio.is_default = row[:default] == 'true'
prio.project = project

@ -35,5 +35,5 @@ Given /^there is a project named "([^"]*)"(?: of type "([^"]*)")?$/ do |name, pr
attributes.merge!(project_type: ProjectType.find_by!(name: project_type_name))
end
FactoryGirl.create(:project, attributes)
FactoryBot.create(:project, attributes)
end

@ -30,7 +30,7 @@
Given /^the [Pp]roject "([^\"]*)" has (\d+) [wW]ork [pP]ackage [qQ]uer(?:ies|y)? with(?: the following)?:$/ do |project, count, table|
p = Project.find_by(name: project) || Project.find_by(identifier: project)
as_admin count do
i = FactoryGirl.build(:query, project: p)
i = FactoryBot.build(:query, project: p)
send_table_to_object(i, table)
i.save
end
@ -39,7 +39,7 @@ end
Given /^the [Pp]roject "([^\"]*)" has (\d+) [wW]ork [pP]ackage [qQ]uer(?:ies|y)?$/ do |project, count|
p = Project.find_by(name: project) || Project.find_by(identifier: project)
as_admin count do
i = FactoryGirl.build(:query, project: p)
i = FactoryBot.build(:query, project: p)
i.save
end
end

@ -30,7 +30,7 @@
Given(/^the project "(.*?)" has a repository$/) do |project_name|
project = Project.find(project_name)
repo = FactoryGirl.build(:repository_subversion,
repo = FactoryBot.build(:repository_subversion,
project: project)
Setting.enabled_scm = Setting.enabled_scm << repo.vendor

@ -41,16 +41,16 @@ Given /^the [Uu]ser "([^\"]*)" is a "([^\"]*)" (?:in|of) the [Pp]roject "([^\"]*
end
Given /^there is a [rR]ole "([^\"]*)"$/ do |name, _table = nil|
FactoryGirl.create(:role, name: name) unless Role.find_by(name: name)
FactoryBot.create(:role, name: name) unless Role.find_by(name: name)
end
Given /^there is a [rR]ole "([^\"]*)" with the following permissions:?$/ do |name, table|
FactoryGirl.create(:role, name: name, permissions: table.raw.flatten) unless Role.find_by(name: name)
FactoryBot.create(:role, name: name, permissions: table.raw.flatten) unless Role.find_by(name: name)
end
Given /^there are the following roles:$/ do |table|
table.raw.flatten.each do |name|
FactoryGirl.create(:role, name: name) unless Role.find_by(name: name)
FactoryBot.create(:role, name: name) unless Role.find_by(name: name)
end
end

@ -28,7 +28,7 @@
#++
Given(/^there are (\d+) work packages with "(.*?)" in their description$/) do |num, desc|
work_packages = FactoryGirl.create_list :work_package, num.to_i, description: desc
work_packages = FactoryBot.create_list :work_package, num.to_i, description: desc
time = Time.now
# ensure temporal order:
work_packages.reverse.each_with_index do |wp, i|

@ -37,7 +37,7 @@ Given /^there are the following status:$/ do |table|
attributes = row.inject({}) { |mem, (k, v)| mem[k.to_sym] = v if v.present?; mem }
attributes[:is_default] = attributes.delete(:default) == 'true'
FactoryGirl.create(:status, attributes)
FactoryBot.create(:status, attributes)
end
end

@ -29,11 +29,11 @@
Given(/^there is a time entry for "(.*?)" with (\d+) hours$/) do |subject, hours|
work_package = WorkPackage.find_by(subject: subject)
time_entry = FactoryGirl.create(:time_entry, work_package: work_package, hours: hours, project: work_package.project)
time_entry = FactoryBot.create(:time_entry, work_package: work_package, hours: hours, project: work_package.project)
end
Given(/^there is an activity "(.*?)"$/) do |name|
FactoryGirl.create(:time_entry_activity, name: name)
FactoryBot.create(:time_entry_activity, name: name)
end
When(/^I log (\d+) hours with the comment "(.*?)"$/) do |hours, comment|

@ -35,7 +35,7 @@ RouteMap.register(::Type, '/types')
Given /^the following types are enabled for the project called "(.*?)":$/ do |project_name, type_name_table|
types = type_name_table.raw.flatten.map { |type_name|
::Type.find_by(name: type_name) || FactoryGirl.create(:type, name: type_name)
::Type.find_by(name: type_name) || FactoryBot.create(:type, name: type_name)
}
project = Project.find_by(identifier: project_name)

@ -73,7 +73,7 @@ Given /^there is 1 [Uu]ser with(?: the following)?:$/ do |table|
user = User.find_by_login(login) unless login.blank?
if !user
user = FactoryGirl.create(:user)
user = FactoryBot.create(:user)
user.pref
user.password = user.password_confirmation = nil
end
@ -110,7 +110,7 @@ end
Given /^there are the following users:$/ do |table|
table.raw.flatten.each do |login|
FactoryGirl.create(:user, login: login)
FactoryBot.create(:user, login: login)
end
end

@ -34,7 +34,7 @@ Given /^the [Pp]roject (.+) has 1 version with(?: the following)?:$/ do |project
p = Project.find_by(name: project) || Project.find_by(identifier: project)
as_admin do
v = FactoryGirl.build(:version) { |v|
v = FactoryBot.build(:version) { |v|
v.project = p
}
send_table_to_object(v, table)

@ -32,8 +32,8 @@ Given /^the [Pp]roject "([^\"]*)" has 1 [wW]iki(?: )?[pP]age with the following:
p.wiki = Wiki.create unless p.wiki
page = FactoryGirl.create(:wiki_page, wiki: p.wiki)
content = FactoryGirl.create(:wiki_content, page: page)
page = FactoryBot.create(:wiki_page, wiki: p.wiki)
content = FactoryBot.create(:wiki_content, page: page)
send_table_to_object(page, table)
end
@ -43,7 +43,7 @@ Given /^there are no wiki menu items$/ do
end
Given /^the project "(.*?)" has (?:1|a) wiki menu item with the following:$/ do |project_name, table|
item = FactoryGirl.build(:wiki_menu_item)
item = FactoryBot.build(:wiki_menu_item)
send_table_to_object(item, table)
item.wiki = Project.find_by(name: project_name).wiki
item.save!
@ -51,11 +51,11 @@ end
Given /^the project "(.*?)" has a child wiki page of "(.*?)" with the following:$/ do |project_name, parent_page_title, table|
wiki = Project.find_by(name: project_name).wiki
wikipage = FactoryGirl.build(:wiki_page, wiki: wiki)
wikipage = FactoryBot.build(:wiki_page, wiki: wiki)
send_table_to_object(wikipage, table)
FactoryGirl.create(:wiki_content, page: wikipage)
FactoryBot.create(:wiki_content, page: wikipage)
parent_page = WikiPage.find_by(wiki_id: wiki.id, title: parent_page_title)
wikipage.parent_id = parent_page.id
@ -87,15 +87,15 @@ Given /^the wiki page "([^"]*)" of the project "([^"]*)" has (\d+) versions{0,1}
wiki = project.wiki
wp = wiki.pages.find_or_create_by(title: page)
wp.save! unless wp.persisted?
wc = wp.content || FactoryGirl.create(:wiki_content, page: wp)
wc = wp.content || FactoryBot.create(:wiki_content, page: wp)
last_version = wc.journals.max(&:version).version
version_count.to_i.times.each do |v|
version = last_version + v + 1
data = FactoryGirl.build(:journal_wiki_content_journal,
data = FactoryBot.build(:journal_wiki_content_journal,
text: "This is version #{version}")
FactoryGirl.create(:wiki_content_journal,
FactoryBot.create(:wiki_content_journal,
version: version,
data: data,
journable_id: wc.id)

@ -33,7 +33,7 @@ Given(/^the work package "(.*?)" has the following changesets:$/) do |subject, t
repo = wp.project.repository
wp_changesets = table.hashes.map { |row|
FactoryGirl.build(:changeset, row.merge(repository: repo))
FactoryBot.build(:changeset, row.merge(repository: repo))
}
wp.changesets = wp_changesets

@ -48,7 +48,7 @@ Given /^a relation between "(.*?)" and "(.*?)"$/ do |work_package_from, work_pac
from = WorkPackage.find_by(subject: work_package_from)
to = WorkPackage.find_by(subject: work_package_to)
FactoryGirl.create :relation, from: from, to: to
FactoryBot.create :relation, from: from, to: to
end
Given /^user is already watching "(.*?)"$/ do |work_package_subject|

@ -42,7 +42,7 @@ end
require 'cucumber/rails'
require 'cucumber/rspec/doubles'
require 'capybara-screenshot/cucumber'
require 'factory_girl_rails'
require 'factory_bot_rails'
# Load paths to ensure they are loaded before the plugin's paths.rbs.
# Plugin's path_to functions rely on being loaded after the core's path_to
@ -150,8 +150,8 @@ Before do
end
Before do
FactoryGirl.create(:non_member)
FactoryGirl.create(:anonymous_role)
FactoryBot.create(:non_member)
FactoryBot.create(:anonymous_role)
end
World(Capybara::Select2)

@ -65,8 +65,8 @@ module OpenProject::Plugins
end
# adds our factories to factory girl's load path
initializer "#{engine_name}.register_factories", after: 'factory_girl.set_factory_paths' do |_app|
FactoryGirl.definition_file_paths << File.expand_path(root.to_s + '/spec/factories') if defined?(FactoryGirl)
initializer "#{engine_name}.register_factories", after: 'factory_bot.set_factory_paths' do |_app|
FactoryBot.definition_file_paths << File.expand_path(root.to_s + '/spec/factories') if defined?(FactoryBot)
end
initializer "#{engine_name}.append_migrations" do |app|

@ -31,9 +31,9 @@
require 'spec_helper'
describe CustomActions::CUContract do
let(:user) { FactoryGirl.build_stubbed(:user) }
let(:user) { FactoryBot.build_stubbed(:user) }
let(:action) do
FactoryGirl.build_stubbed(:custom_action, actions:
FactoryBot.build_stubbed(:custom_action, actions:
[CustomActions::Actions::AssignedTo.new])
end
let(:instance) { described_class.new(action) }

@ -31,9 +31,9 @@
require 'spec_helper'
describe Relations::CreateContract do
let(:from) { FactoryGirl.build_stubbed :work_package }
let(:to) { FactoryGirl.build_stubbed :work_package }
let(:user) { FactoryGirl.build_stubbed :admin }
let(:from) { FactoryBot.build_stubbed :work_package }
let(:to) { FactoryBot.build_stubbed :work_package }
let(:user) { FactoryBot.build_stubbed :admin }
let(:relation) do
Relation.new from: from, to: to, relation_type: "follows", delay: 42

@ -30,7 +30,7 @@
require 'spec_helper'
describe Users::CreateContract do
let(:user) { FactoryGirl.build_stubbed(:user) }
let(:user) { FactoryBot.build_stubbed(:user) }
subject(:contract) { described_class.new(user, current_user) }
@ -49,7 +49,7 @@ describe Users::CreateContract do
end
context 'when admin' do
let(:current_user) { FactoryGirl.build_stubbed(:admin) }
let(:current_user) { FactoryBot.build_stubbed(:admin) }
it_behaves_like 'is valid'
@ -74,7 +74,7 @@ describe Users::CreateContract do
end
context 'when not admin' do
let(:current_user) { FactoryGirl.build_stubbed(:user) }
let(:current_user) { FactoryBot.build_stubbed(:user) }
it 'is invalid' do
expect_valid(false, base: %i(error_unauthorized))

@ -30,15 +30,15 @@ require 'spec_helper'
describe WorkPackages::BaseContract do
let(:work_package) do
FactoryGirl.build_stubbed(:stubbed_work_package,
FactoryBot.build_stubbed(:stubbed_work_package,
type: type,
done_ratio: 50,
estimated_hours: 6.0,
project: project)
end
let(:type) { FactoryGirl.build_stubbed(:type) }
let(:type) { FactoryBot.build_stubbed(:type) }
let(:member) do
u = FactoryGirl.build_stubbed(:user)
u = FactoryBot.build_stubbed(:user)
allow(u)
.to receive(:allowed_to?)
@ -53,7 +53,7 @@ describe WorkPackages::BaseContract do
u
end
let(:project) { FactoryGirl.build_stubbed(:project) }
let(:project) { FactoryBot.build_stubbed(:project) }
let(:current_user) { member }
let(:permissions) do
%i(
@ -237,7 +237,7 @@ describe WorkPackages::BaseContract do
context 'before soonest start date of parent' do
before do
work_package.parent = FactoryGirl.build_stubbed(:work_package)
work_package.parent = FactoryBot.build_stubbed(:work_package)
allow(work_package)
.to receive(:soonest_start)
.and_return(Date.today + 4.days)
@ -299,8 +299,8 @@ describe WorkPackages::BaseContract do
describe 'fixed_version' do
subject(:contract) { described_class.new(work_package, current_user) }
let(:assignable_version) { FactoryGirl.build_stubbed(:version) }
let(:invalid_version) { FactoryGirl.build_stubbed(:version) }
let(:assignable_version) { FactoryBot.build_stubbed(:version) }
let(:invalid_version) { FactoryBot.build_stubbed(:version) }
before do
allow(work_package)
@ -331,7 +331,7 @@ describe WorkPackages::BaseContract do
end
context 'for a closed version' do
let(:assignable_version) { FactoryGirl.build_stubbed(:version, status: 'closed') }
let(:assignable_version) { FactoryBot.build_stubbed(:version, status: 'closed') }
context 'when reopening a work package' do
before do
@ -362,8 +362,8 @@ describe WorkPackages::BaseContract do
end
describe 'parent' do
let(:child) { FactoryGirl.build_stubbed(:stubbed_work_package) }
let(:parent) { FactoryGirl.build_stubbed(:stubbed_work_package) }
let(:child) { FactoryBot.build_stubbed(:stubbed_work_package) }
let(:parent) { FactoryBot.build_stubbed(:stubbed_work_package) }
before do
work_package.parent = parent
@ -428,7 +428,7 @@ describe WorkPackages::BaseContract do
end
describe 'changing the type' do
let(:other_type) { FactoryGirl.build_stubbed(:type) }
let(:other_type) { FactoryBot.build_stubbed(:type) }
it 'is invalid' do
work_package.type = other_type
@ -441,7 +441,7 @@ describe WorkPackages::BaseContract do
end
describe 'changing the project (and that one not having the type)' do
let(:other_project) { FactoryGirl.build_stubbed(:project) }
let(:other_project) { FactoryBot.build_stubbed(:project) }
it 'is invalid' do
work_package.project = other_project
@ -456,7 +456,7 @@ describe WorkPackages::BaseContract do
end
describe 'category' do
let(:category) { FactoryGirl.build_stubbed(:category) }
let(:category) { FactoryBot.build_stubbed(:category) }
context "one of the project's categories" do
before do
@ -520,8 +520,8 @@ describe WorkPackages::BaseContract do
end
describe 'priority' do
let (:active_priority) { FactoryGirl.build_stubbed(:priority) }
let (:inactive_priority) { FactoryGirl.build_stubbed(:priority, active: false) }
let (:active_priority) { FactoryBot.build_stubbed(:priority) }
let (:inactive_priority) { FactoryBot.build_stubbed(:priority, active: false) }
context 'active priority' do
before do
@ -565,9 +565,9 @@ describe WorkPackages::BaseContract do
end
describe 'status' do
let(:roles) { [FactoryGirl.build_stubbed(:role)] }
let(:roles) { [FactoryBot.build_stubbed(:role)] }
let(:valid_transition_result) { true }
let(:new_status) { FactoryGirl.build_stubbed(:status) }
let(:new_status) { FactoryBot.build_stubbed(:status) }
let(:from_id) { work_package.status_id }
let(:to_id) { new_status.id }
let(:status_change) { work_package.status = new_status }
@ -619,7 +619,7 @@ describe WorkPackages::BaseContract do
let(:valid_transition_result) { false }
let(:status_change) do
work_package.status = new_status
work_package.type = FactoryGirl.build_stubbed(:type)
work_package.type = FactoryBot.build_stubbed(:type)
end
it 'is valid' do

@ -32,8 +32,8 @@ require 'contracts/work_packages/shared_base_contract'
describe WorkPackages::CreateContract do
let(:work_package) { WorkPackage.new }
let(:project) { FactoryGirl.build_stubbed(:project) }
let(:user) { FactoryGirl.build_stubbed(:user) }
let(:project) { FactoryBot.build_stubbed(:project) }
let(:user) { FactoryBot.build_stubbed(:user) }
subject(:contract) { described_class.new(work_package, user) }
let(:validated_contract) {
@ -125,7 +125,7 @@ describe WorkPackages::CreateContract do
end
it 'is invalid if the user is different from the user the contract is evaluated for' do
work_package.author = FactoryGirl.build_stubbed(:user)
work_package.author = FactoryBot.build_stubbed(:user)
expect(validated_contract.errors.symbols_for(:author_id))
.to match_array [:invalid]

@ -31,7 +31,7 @@ require 'spec_helper'
describe WorkPackages::CreateNoteContract do
let(:work_package) do
# As we only want to test the contract, we mock checking whether the work_package is valid
wp = FactoryGirl.build_stubbed(:work_package)
wp = FactoryBot.build_stubbed(:work_package)
# we need to clear the changes information because otherwise the
# contract will complain about all the changes to read_only attributes
wp.send(:clear_changes_information)
@ -39,7 +39,7 @@ describe WorkPackages::CreateNoteContract do
wp
end
let(:user) { FactoryGirl.build_stubbed(:user) }
let(:user) { FactoryBot.build_stubbed(:user) }
let(:policy_instance) { double('WorkPackagePolicyInstance') }
subject(:contract) {

@ -29,9 +29,9 @@
#++
shared_examples_for 'work package contract' do
let(:project) { FactoryGirl.build_stubbed(:project) }
let(:user) { FactoryGirl.build_stubbed(:user) }
let(:other_user) { FactoryGirl.build_stubbed(:user) }
let(:project) { FactoryBot.build_stubbed(:project) }
let(:user) { FactoryBot.build_stubbed(:user) }
let(:other_user) { FactoryBot.build_stubbed(:user) }
let(:policy) { double(WorkPackagePolicy, allowed?: true) }
subject(:contract) { described_class.new(work_package, user) }

@ -30,16 +30,16 @@ require 'spec_helper'
require 'contracts/work_packages/shared_base_contract'
describe WorkPackages::UpdateContract do
let(:project) { FactoryGirl.create(:project, is_public: false) }
let(:work_package) { FactoryGirl.create(:work_package, project: project) }
let(:user) { FactoryGirl.create(:user, member_in_project: project, member_through_role: role) }
let(:role) { FactoryGirl.create(:role, permissions: permissions) }
let(:project) { FactoryBot.create(:project, is_public: false) }
let(:work_package) { FactoryBot.create(:work_package, project: project) }
let(:user) { FactoryBot.create(:user, member_in_project: project, member_through_role: role) }
let(:role) { FactoryBot.create(:role, permissions: permissions) }
let(:permissions) { [:view_work_packages, :edit_work_packages] }
subject(:contract) { described_class.new(work_package, user) }
it_behaves_like 'work package contract' do
let(:work_package) { FactoryGirl.build_stubbed(:work_package) }
let(:work_package) { FactoryBot.build_stubbed(:work_package) }
end
describe 'lock_version' do
@ -93,14 +93,14 @@ describe WorkPackages::UpdateContract do
end
describe 'project_id' do
let(:target_project) { FactoryGirl.create(:project) }
let(:target_project) { FactoryBot.create(:project) }
let(:target_permissions) { [:move_work_packages] }
before do
FactoryGirl.create :member,
FactoryBot.create :member,
user: user,
project: target_project,
roles: [FactoryGirl.create(:role, permissions: target_permissions)]
roles: [FactoryBot.create(:role, permissions: target_permissions)]
work_package.project = target_project
@ -120,7 +120,7 @@ describe WorkPackages::UpdateContract do
end
describe 'parent_id' do
let(:parent) { FactoryGirl.create(:work_package) }
let(:parent) { FactoryBot.create(:work_package) }
before do
work_package.parent_id = parent.id

@ -33,7 +33,7 @@ describe AccountController, type: :controller do
User.delete_all
User.current = nil
end
let(:user) { FactoryGirl.build_stubbed(:user) }
let(:user) { FactoryBot.build_stubbed(:user) }
context 'GET #login' do
let(:setup) {}
@ -80,7 +80,7 @@ describe AccountController, type: :controller do
end
context 'POST #login' do
let(:admin) { FactoryGirl.create(:admin) }
let(:admin) { FactoryBot.create(:admin) }
describe 'wrong password' do
it 'redirects back to login' do
@ -229,7 +229,7 @@ describe AccountController, type: :controller do
end
context 'GET #logout' do
let(:admin) { FactoryGirl.create(:admin) }
let(:admin) { FactoryBot.create(:admin) }
it 'calls reset_session' do
expect(@controller).to receive(:reset_session).once
@ -293,7 +293,7 @@ describe AccountController, type: :controller do
end
describe 'Login for user with forced password change' do
let(:admin) { FactoryGirl.create(:admin, force_password_change: true) }
let(:admin) { FactoryBot.create(:admin, force_password_change: true) }
before do
allow_any_instance_of(User).to receive(:change_password_allowed?).and_return(false)
@ -389,7 +389,7 @@ describe AccountController, type: :controller do
end
context 'with self registration off but an ongoing invitation activation' do
let(:token) { FactoryGirl.create :invitation_token }
let(:token) { FactoryBot.create :invitation_token }
before do
allow(Setting).to receive(:self_registration).and_return('0')
@ -654,7 +654,7 @@ describe AccountController, type: :controller do
}
end
let(:user) { FactoryGirl.create :user, status: 2 }
let(:user) { FactoryBot.create :user, status: 2 }
before do
session[:auth_source_sso_failure] = failure
@ -674,9 +674,9 @@ describe AccountController, type: :controller do
end
context "with an invalid user" do
let!(:duplicate) { FactoryGirl.create :user, mail: "login@DerpLAP.net" }
let!(:duplicate) { FactoryBot.create :user, mail: "login@DerpLAP.net" }
let(:user) do
FactoryGirl.build(:user, mail: duplicate.mail).tap(&:valid?)
FactoryBot.build(:user, mail: duplicate.mail).tap(&:valid?)
end
it "should show the account creation form with an error" do
@ -733,13 +733,13 @@ describe AccountController, type: :controller do
context 'with an invited user' do
it_behaves_like 'account activation' do
let(:user) { FactoryGirl.create :user, status: 4 }
let(:user) { FactoryBot.create :user, status: 4 }
end
end
context 'with an registered user' do
it_behaves_like 'account activation' do
let(:user) { FactoryGirl.create :user, status: 2 }
let(:user) { FactoryBot.create :user, status: 2 }
end
end
end

@ -32,7 +32,7 @@ describe ActivitiesController, type: :controller do
before :each do
allow(@controller).to receive(:set_localization)
admin = FactoryGirl.create(:admin)
admin = FactoryBot.create(:admin)
allow(User).to receive(:current).and_return admin
@params = {}
@ -46,13 +46,13 @@ describe ActivitiesController, type: :controller do
end
describe 'global' do
let(:work_package) { FactoryGirl.create(:work_package) }
let(:work_package) { FactoryBot.create(:work_package) }
let!(:journal) {
FactoryGirl.create(:work_package_journal,
FactoryBot.create(:work_package_journal,
journable_id: work_package.id,
created_at: 3.days.ago.to_date.to_s(:db),
version: Journal.maximum(:version) + 1,
data: FactoryGirl.build(:journal_work_package_journal,
data: FactoryBot.build(:journal_work_package_journal,
subject: work_package.subject,
status_id: work_package.status_id,
type_id: work_package.type_id,
@ -92,7 +92,7 @@ describe ActivitiesController, type: :controller do
describe 'with activated activity module' do
let(:project) {
FactoryGirl.create(:project,
FactoryBot.create(:project,
enabled_module_names: %w[activity wiki])
}
@ -105,7 +105,7 @@ describe ActivitiesController, type: :controller do
describe 'without activated activity module' do
let(:project) {
FactoryGirl.create(:project,
FactoryBot.create(:project,
enabled_module_names: %w[wiki])
}
@ -123,12 +123,12 @@ describe ActivitiesController, type: :controller do
end
describe '#atom_feed' do
let(:user) { FactoryGirl.create(:user) }
let(:project) { FactoryGirl.create(:project) }
let(:user) { FactoryBot.create(:user) }
let(:project) { FactoryBot.create(:project) }
context 'work_package' do
let!(:wp_1) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
project: project,
author: user)
}
@ -147,7 +147,7 @@ describe ActivitiesController, type: :controller do
describe 'list' do
let!(:wp_2) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
project: project,
author: user)
}
@ -167,15 +167,15 @@ describe ActivitiesController, type: :controller do
context 'boards' do
let(:board) {
FactoryGirl.create(:board,
FactoryBot.create(:board,
project: project)
}
let!(:message_1) {
FactoryGirl.create(:message,
FactoryBot.create(:message,
board: board)
}
let!(:message_2) {
FactoryGirl.create(:message,
FactoryBot.create(:message,
board: board)
}
let(:params) {

@ -1,7 +1,7 @@
require 'spec_helper'
describe AnnouncementsController, type: :controller do
let(:announcement) { FactoryGirl.build :announcement }
let(:announcement) { FactoryBot.build :announcement }
before do
allow(controller).to receive(:check_if_login_required)
expect(controller).to receive(:require_admin)

@ -29,7 +29,7 @@
require 'spec_helper'
describe ApplicationController, type: :controller do
let(:user) { FactoryGirl.create(:user, lastname: "Crazy! Name with \r\n Newline") }
let(:user) { FactoryBot.create(:user, lastname: "Crazy! Name with \r\n Newline") }
# Fake controller to test calling an action
controller do
@ -109,7 +109,7 @@ describe ApplicationController, type: :controller do
end
it 'logs out the user' do
@controller.send(:logged_user=, FactoryGirl.create(:user))
@controller.send(:logged_user=, FactoryBot.create(:user))
allow(@controller).to receive(:render_error)
@controller.send :handle_unverified_request

@ -29,16 +29,16 @@
require 'spec_helper'
describe AttachmentsController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:project) { FactoryGirl.create(:project) }
let(:user) { FactoryBot.create(:user) }
let(:project) { FactoryBot.create(:project) }
let(:role) {
FactoryGirl.create(:role,
FactoryBot.create(:role,
permissions: [:edit_work_packages,
:view_work_packages,
:delete_wiki_pages_attachments])
}
let!(:member) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project,
principal: user,
roles: [role])
@ -48,7 +48,7 @@ describe AttachmentsController, type: :controller do
describe '#destroy' do
let(:attachment) {
FactoryGirl.create(:attachment,
FactoryBot.create(:attachment,
container: container)
}
@ -68,7 +68,7 @@ describe AttachmentsController, type: :controller do
context 'work_package' do
let(:container) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
author: user,
project: project)
}
@ -85,7 +85,7 @@ describe AttachmentsController, type: :controller do
context 'wiki' do
let(:container) {
FactoryGirl.create(:wiki_page,
FactoryBot.create(:wiki_page,
wiki: project.wiki)
}
let(:redirect_path) { project_wiki_path(project, project.wiki) }
@ -104,7 +104,7 @@ describe AttachmentsController, type: :controller do
describe '#download' do
let(:file) { FileHelpers.mock_uploaded_file name: 'foobar.txt' }
let(:work_package) { FactoryGirl.create :work_package, project: project }
let(:work_package) { FactoryBot.create :work_package, project: project }
let(:uploader) { nil }
##

@ -1,7 +1,7 @@
require 'spec_helper'
describe AttributeHelpTextsController, type: :controller do
let(:model) { FactoryGirl.build :work_package_help_text }
let(:model) { FactoryBot.build :work_package_help_text }
let(:relation_columns_allowed) { true }
let(:find_expectation) do

@ -29,7 +29,7 @@
require 'spec_helper'
describe AuthSourcesController, type: :controller do
let(:current_user) { FactoryGirl.create(:admin) }
let(:current_user) { FactoryBot.create(:admin) }
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(false)
@ -74,7 +74,7 @@ describe AuthSourcesController, type: :controller do
describe 'edit' do
before do
@auth_source = FactoryGirl.create(:auth_source, name: 'TestEdit')
@auth_source = FactoryBot.create(:auth_source, name: 'TestEdit')
get :edit, params: { id: @auth_source.id }
end
@ -85,7 +85,7 @@ describe AuthSourcesController, type: :controller do
describe 'update' do
before do
@auth_source = FactoryGirl.create(:auth_source, name: 'TestEdit')
@auth_source = FactoryBot.create(:auth_source, name: 'TestEdit')
post :update, params: { id: @auth_source.id, auth_source: { name: 'TestUpdate' } }
end
@ -96,7 +96,7 @@ describe AuthSourcesController, type: :controller do
describe 'destroy' do
before do
@auth_source = FactoryGirl.create(:auth_source, name: 'TestEdit')
@auth_source = FactoryBot.create(:auth_source, name: 'TestEdit')
end
context 'without users' do
@ -111,7 +111,7 @@ describe AuthSourcesController, type: :controller do
context 'with users' do
before do
FactoryGirl.create(:user, auth_source: @auth_source)
FactoryBot.create(:user, auth_source: @auth_source)
post :destroy, params: { id: @auth_source.id }
end

@ -29,10 +29,10 @@
require 'spec_helper'
describe BoardsController, type: :controller do
let(:user) { FactoryGirl.build(:user) }
let(:project) { FactoryGirl.create(:project) }
let(:user) { FactoryBot.build(:user) }
let(:project) { FactoryBot.create(:project) }
let!(:board) {
FactoryGirl.build(:board,
FactoryBot.build(:board,
project: project)
}
@ -95,14 +95,14 @@ describe BoardsController, type: :controller do
end
describe '#move' do
let(:project) { FactoryGirl.create(:project) }
let(:project) { FactoryBot.create(:project) }
let!(:board_1) {
FactoryGirl.create(:board,
FactoryBot.create(:board,
project: project,
position: 1)
}
let!(:board_2) {
FactoryGirl.create(:board,
FactoryBot.create(:board,
project: project,
position: 2)
}
@ -129,7 +129,7 @@ describe BoardsController, type: :controller do
describe '#update' do
let!(:board) {
FactoryGirl.create(:board, name: 'Board name',
FactoryBot.create(:board, name: 'Board name',
description: 'Board description')
}
@ -186,10 +186,10 @@ describe BoardsController, type: :controller do
end
describe '#sticky' do
let!(:message1) { FactoryGirl.create(:message, board: board) }
let!(:message2) { FactoryGirl.create(:message, board: board) }
let!(:message1) { FactoryBot.create(:message, board: board) }
let!(:message2) { FactoryBot.create(:message, board: board) }
let!(:sticked_message1) {
FactoryGirl.create(:message, board_id: board.id,
FactoryBot.create(:message, board_id: board.id,
subject: 'How to',
content: 'How to install this cool app',
sticky: '1',
@ -197,7 +197,7 @@ describe BoardsController, type: :controller do
}
let!(:sticked_message2) {
FactoryGirl.create(:message, board_id: board.id,
FactoryBot.create(:message, board_id: board.id,
subject: 'FAQ',
content: 'Frequestly asked question',
sticky: '1',

@ -29,14 +29,14 @@
require 'spec_helper'
describe CategoriesController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:project) { FactoryGirl.create(:project) }
let(:user) { FactoryBot.create(:user) }
let(:project) { FactoryBot.create(:project) }
let(:role) {
FactoryGirl.create(:role,
FactoryBot.create(:role,
permissions: [:manage_categories])
}
let(:member) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project,
principal: user,
roles: [role])
@ -93,7 +93,7 @@ describe CategoriesController, type: :controller do
describe '#edit' do
let(:category) {
FactoryGirl.create(:category,
FactoryBot.create(:category,
project: project)
}
@ -120,7 +120,7 @@ describe CategoriesController, type: :controller do
context 'valid category' do
let(:category) {
FactoryGirl.create(:category,
FactoryBot.create(:category,
project: project)
}
@ -162,11 +162,11 @@ describe CategoriesController, type: :controller do
describe '#destroy' do
let(:category) {
FactoryGirl.create(:category,
FactoryBot.create(:category,
project: project)
}
let(:work_package) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
project: project,
category: category)
}
@ -211,7 +211,7 @@ describe CategoriesController, type: :controller do
describe '#reassign' do
let(:target) {
FactoryGirl.create(:category,
FactoryBot.create(:category,
project: project)
}
before do

@ -45,7 +45,7 @@ describe MyController, type: :controller do
let(:secret) { "42" }
let(:auth_source) { DummyAuthSource.create name: "Dummy LDAP" }
let(:user) { FactoryGirl.create :user, login: login, auth_source_id: auth_source.id }
let(:user) { FactoryBot.create :user, login: login, auth_source_id: auth_source.id }
let(:login) { "h.wurst" }
before do
@ -95,7 +95,7 @@ describe MyController, type: :controller do
end
context "with a non-active user user" do
let(:user) { FactoryGirl.create :user, login: login, auth_source_id: auth_source.id, status: 2 }
let(:user) { FactoryBot.create :user, login: login, auth_source_id: auth_source.id, status: 2 }
it_should_behave_like "auth source sso failure"
end
@ -103,11 +103,11 @@ describe MyController, type: :controller do
context "with an invalid user" do
let(:auth_source) { DummyAuthSource.create name: "Onthefly LDAP", onthefly_register: true }
let!(:duplicate) { FactoryGirl.create :user, mail: "login@DerpLAP.net" }
let!(:duplicate) { FactoryBot.create :user, mail: "login@DerpLAP.net" }
let(:login) { "dummy_dupuser" }
let(:user) do
FactoryGirl.build :user, login: login, mail: duplicate.mail, auth_source_id: auth_source.id
FactoryBot.build :user, login: login, mail: duplicate.mail, auth_source_id: auth_source.id
end
it_should_behave_like "auth source sso failure"

@ -264,7 +264,7 @@ describe AccountController, type: :controller do
end
let(:user) do
FactoryGirl.build(:user, force_password_change: false,
FactoryBot.build(:user, force_password_change: false,
identity_url: 'google:123545')
end

@ -48,8 +48,8 @@ describe UserInvitation do
end
describe '.reinvite_user' do
let(:user) { FactoryGirl.create :invited_user }
let!(:token) { FactoryGirl.create :invitation_token, user: user }
let(:user) { FactoryBot.create :invited_user }
let!(:token) { FactoryBot.create :invitation_token, user: user }
it 'notifies listeners of the re-invite' do
expect(OpenProject::Notifications).to receive(:send) do |event, new_token|

@ -29,10 +29,10 @@
require 'spec_helper'
describe CopyProjectsController, type: :controller do
let(:current_user) { FactoryGirl.create(:admin) }
let(:current_user) { FactoryBot.create(:admin) }
let(:redirect_path) { "/projects/#{project.id}/settings" }
let(:permission) { :copy_projects }
let(:project) { FactoryGirl.create(:project_with_types, is_public: false) }
let(:project) { FactoryBot.create(:project_with_types, is_public: false) }
let(:copy_project_params) {
{
'description' => 'Some pretty description',
@ -139,7 +139,7 @@ describe CopyProjectsController, type: :controller do
end
let(:permission) { [:copy_projects, :add_project] }
let(:project) { FactoryGirl.create(:project, is_public: false) }
let(:project) { FactoryBot.create(:project, is_public: false) }
it_should_behave_like 'a controller action which needs project permissions'
end

@ -29,9 +29,9 @@
require 'spec_helper'
describe CustomActionsController, type: :controller do
let(:admin) { FactoryGirl.build(:admin) }
let(:non_admin) { FactoryGirl.build(:user) }
let(:action) { FactoryGirl.build_stubbed(:custom_action) }
let(:admin) { FactoryBot.build(:admin) }
let(:non_admin) { FactoryBot.build(:user) }
let(:action) { FactoryBot.build_stubbed(:custom_action) }
let(:params) do
{ custom_action: { name: 'blubs',
actions: { assigned_to: 1 } } }

@ -29,7 +29,7 @@
require 'spec_helper'
describe CustomFieldsController, type: :controller do
let(:custom_field) { FactoryGirl.build_stubbed(:custom_field) }
let(:custom_field) { FactoryBot.build_stubbed(:custom_field) }
before do
allow(@controller).to receive(:authorize)

@ -34,7 +34,7 @@ describe CustomStylesController, type: :controller do
end
context 'with admin' do
let(:user) { FactoryGirl.build(:admin) }
let(:user) { FactoryBot.build(:admin) }
describe '#show' do
subject { get :show }
@ -108,7 +108,7 @@ describe CustomStylesController, type: :controller do
end
describe "#update" do
let(:custom_style) { FactoryGirl.build(:custom_style_with_logo) }
let(:custom_style) { FactoryBot.build(:custom_style_with_logo) }
let(:params) do
{
custom_style: { logo: 'foo', favicon: 'bar', icon_touch: 'yay' }
@ -152,7 +152,7 @@ describe CustomStylesController, type: :controller do
end
context "when logo is present" do
let(:custom_style) { FactoryGirl.build(:custom_style_with_logo) }
let(:custom_style) { FactoryBot.build(:custom_style_with_logo) }
it 'will send a file' do
expect(response.status).to eq(200)
@ -169,7 +169,7 @@ describe CustomStylesController, type: :controller do
end
context "when no logo is present" do
let(:custom_style) { FactoryGirl.build_stubbed(:custom_style) }
let(:custom_style) { FactoryBot.build_stubbed(:custom_style) }
it 'renders with error' do
expect(controller).to_not receive(:send_file)
@ -179,7 +179,7 @@ describe CustomStylesController, type: :controller do
end
describe "#logo_delete" do
let(:custom_style) { FactoryGirl.build(:custom_style_with_logo) }
let(:custom_style) { FactoryBot.build(:custom_style_with_logo) }
before do
with_enterprise_token(:define_custom_style)
@ -219,7 +219,7 @@ describe CustomStylesController, type: :controller do
end
context "when favicon is present" do
let(:custom_style) { FactoryGirl.build(:custom_style_with_favicon) }
let(:custom_style) { FactoryBot.build(:custom_style_with_favicon) }
it 'will send a file' do
expect(response.status).to eq(200)
@ -236,7 +236,7 @@ describe CustomStylesController, type: :controller do
end
context "when no favicon is present" do
let(:custom_style) { FactoryGirl.build(:custom_style) }
let(:custom_style) { FactoryBot.build(:custom_style) }
it 'renders with error' do
expect(controller).to_not receive(:send_file)
@ -246,7 +246,7 @@ describe CustomStylesController, type: :controller do
end
describe "#favicon_delete" do
let(:custom_style) { FactoryGirl.build(:custom_style_with_favicon) }
let(:custom_style) { FactoryBot.build(:custom_style_with_favicon) }
before do
with_enterprise_token(:define_custom_style)
@ -286,7 +286,7 @@ describe CustomStylesController, type: :controller do
end
context "when touch icon is present" do
let(:custom_style) { FactoryGirl.build(:custom_style_with_touch_icon) }
let(:custom_style) { FactoryBot.build(:custom_style_with_touch_icon) }
it 'will send a file' do
expect(response.status).to eq(200)
@ -303,7 +303,7 @@ describe CustomStylesController, type: :controller do
end
context "when no touch icon is present" do
let(:custom_style) { FactoryGirl.build(:custom_style) }
let(:custom_style) { FactoryBot.build(:custom_style) }
it 'renders with error' do
expect(controller).to_not receive(:send_file)
@ -313,7 +313,7 @@ describe CustomStylesController, type: :controller do
end
describe "#touch_icon_delete" do
let(:custom_style) { FactoryGirl.build(:custom_style_with_touch_icon) }
let(:custom_style) { FactoryBot.build(:custom_style_with_touch_icon) }
before do
with_enterprise_token(:define_custom_style)
@ -381,7 +381,7 @@ describe CustomStylesController, type: :controller do
end
context 'regular user' do
let(:user) { FactoryGirl.build(:user) }
let(:user) { FactoryBot.build(:user) }
describe '#get' do
before do
@ -407,7 +407,7 @@ describe CustomStylesController, type: :controller do
end
context "when logo is present" do
let(:custom_style) { FactoryGirl.build(:custom_style_with_logo) }
let(:custom_style) { FactoryBot.build(:custom_style_with_logo) }
it 'will send a file' do
expect(response.status).to eq(200)

@ -46,7 +46,7 @@ describe EnterprisesController, type: :controller do
end
context 'with admin' do
let(:user) { FactoryGirl.build(:admin) }
let(:user) { FactoryBot.build(:admin) }
describe '#show' do
render_views
@ -142,7 +142,7 @@ describe EnterprisesController, type: :controller do
end
context 'regular user' do
let(:user) { FactoryGirl.build(:user) }
let(:user) { FactoryBot.build(:user) }
before do
get :show

@ -33,7 +33,7 @@ describe EnumerationsController, type: :controller do
describe '#destroy' do
describe '#priority' do
let(:enum_to_delete) { FactoryGirl.create(:priority_normal) }
let(:enum_to_delete) { FactoryBot.create(:priority_normal) }
shared_examples_for 'successful delete' do
it { expect(Enumeration.find_by(id: enum_to_delete.id)).to be_nil }
@ -50,9 +50,9 @@ describe EnumerationsController, type: :controller do
end
describe 'in use' do
let!(:enum_to_reassign) { FactoryGirl.create(:priority_high) }
let!(:enum_to_reassign) { FactoryBot.create(:priority_high) }
let!(:work_package) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
priority: enum_to_delete)
}

@ -70,7 +70,7 @@ describe HomescreenController, type: :controller do
it 'shows the news when available' do
expect(News).to receive(:latest).with(any_args)
.and_return(FactoryGirl.build_stubbed_list(:news, 5, created_on: Time.now))
.and_return(FactoryBot.build_stubbed_list(:news, 5, created_on: Time.now))
get :index
expect(response).to render_template(partial: 'homescreen/blocks/_news')
@ -81,7 +81,7 @@ describe HomescreenController, type: :controller do
end
context 'with enabled announcement' do
let!(:announcement) { FactoryGirl.create :active_announcement }
let!(:announcement) { FactoryBot.create :active_announcement }
it 'renders the announcement' do
expect(response).to render_template(partial: 'announcements/_show')
end
@ -109,14 +109,14 @@ describe HomescreenController, type: :controller do
end
context 'with admin' do
let(:user) { FactoryGirl.build(:admin) }
let(:user) { FactoryBot.build(:admin) }
it_behaves_like 'renders blocks' do
let(:shown) { all_blocks }
end
end
context 'regular user' do
let(:user) { FactoryGirl.build(:user) }
let(:user) { FactoryBot.build(:user) }
it_behaves_like 'renders blocks' do
let(:shown) { all_blocks - %w(administration users) }
end

@ -29,22 +29,22 @@
require 'spec_helper'
describe JournalsController, type: :controller do
let(:user) { FactoryGirl.create(:user, member_in_project: project, member_through_role: role) }
let(:project) { FactoryGirl.create(:project_with_types) }
let(:role) { FactoryGirl.create(:role, permissions: permissions) }
let(:user) { FactoryBot.create(:user, member_in_project: project, member_through_role: role) }
let(:project) { FactoryBot.create(:project_with_types) }
let(:role) { FactoryBot.create(:role, permissions: permissions) }
let(:member) {
FactoryGirl.build(:member, project: project,
FactoryBot.build(:member, project: project,
roles: [role],
principal: user)
}
let(:work_package) {
FactoryGirl.build(:work_package, type: project.types.first,
FactoryBot.build(:work_package, type: project.types.first,
author: user,
project: project,
description: '')
}
let(:journal) {
FactoryGirl.create(:work_package_journal,
FactoryBot.create(:work_package_journal,
journable: work_package,
user: user)
}

@ -29,7 +29,7 @@
require 'spec_helper'
describe LdapAuthSourcesController, type: :controller do
let(:current_user) { FactoryGirl.create(:admin) }
let(:current_user) { FactoryBot.create(:admin) }
before do
allow(User).to receive(:current).and_return current_user

@ -29,12 +29,12 @@
require 'spec_helper'
describe MembersController, type: :controller do
let(:admin) { FactoryGirl.create(:admin) }
let(:user) { FactoryGirl.create(:user) }
let(:project) { FactoryGirl.create(:project, identifier: 'pet_project') }
let(:role) { FactoryGirl.create(:role) }
let(:admin) { FactoryBot.create(:admin) }
let(:user) { FactoryBot.create(:user) }
let(:project) { FactoryBot.create(:project, identifier: 'pet_project') }
let(:role) { FactoryBot.create(:role) }
let(:member) {
FactoryGirl.create(:member, project: project,
FactoryBot.create(:member, project: project,
user: user,
roles: [role])
}
@ -44,8 +44,8 @@ describe MembersController, type: :controller do
end
describe 'create' do
let(:admin) { FactoryGirl.create(:admin) }
let(:project_2) { FactoryGirl.create(:project) }
let(:admin) { FactoryBot.create(:admin) }
let(:project_2) { FactoryBot.create(:project) }
before do
allow(User).to receive(:current).and_return(admin)
@ -75,12 +75,12 @@ describe MembersController, type: :controller do
end
describe 'update' do
let(:admin) { FactoryGirl.create(:admin) }
let(:project_2) { FactoryGirl.create(:project) }
let(:role_1) { FactoryGirl.create(:role) }
let(:role_2) { FactoryGirl.create(:role) }
let(:admin) { FactoryBot.create(:admin) }
let(:project_2) { FactoryBot.create(:project) }
let(:role_1) { FactoryBot.create(:role) }
let(:role_2) { FactoryBot.create(:role) }
let(:member_2) do
FactoryGirl.create(
FactoryBot.create(
:member,
project: project_2,
user: admin,
@ -136,9 +136,9 @@ describe MembersController, type: :controller do
describe '#create' do
render_views
let(:user2) { FactoryGirl.create(:user) }
let(:user3) { FactoryGirl.create(:user) }
let(:user4) { FactoryGirl.create(:user) }
let(:user2) { FactoryBot.create(:user) }
let(:user3) { FactoryBot.create(:user) }
let(:user4) { FactoryBot.create(:user) }
context 'post :create' do
context 'single member' do
@ -218,7 +218,7 @@ describe MembersController, type: :controller do
member: { role_ids: [role2.id], user_id: user.id }
}
}
let(:role2) { FactoryGirl.create(:role) }
let(:role2) { FactoryBot.create(:role) }
before do
member

@ -29,17 +29,17 @@
require 'spec_helper'
describe MessagesController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:project) { FactoryGirl.create(:project) }
let(:role) { FactoryGirl.create(:role) }
let(:user) { FactoryBot.create(:user) }
let(:project) { FactoryBot.create(:project) }
let(:role) { FactoryBot.create(:role) }
let!(:member) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project,
principal: user,
roles: [role])
}
let!(:board) {
FactoryGirl.create(:board,
FactoryBot.create(:board,
project: project)
}
@ -81,8 +81,8 @@ describe MessagesController, type: :controller do
end
describe '#update' do
let(:message) { FactoryGirl.create :message, board: board }
let(:other_board) { FactoryGirl.create :board, project: project }
let(:message) { FactoryBot.create :message, board: board }
let(:other_board) { FactoryBot.create :board, project: project }
before do
role.add_permission!(:edit_messages) and user.reload
@ -96,7 +96,7 @@ describe MessagesController, type: :controller do
end
describe '#attachment' do
let!(:message) { FactoryGirl.create(:message) }
let!(:message) { FactoryBot.create(:message) }
let(:attachment_id) { "attachments_#{message.attachments.first.id}" }
let(:params) {
{ id: message.id,
@ -158,13 +158,13 @@ describe MessagesController, type: :controller do
describe '#remove' do
let!(:attachment) {
FactoryGirl.create(:attachment,
FactoryBot.create(:attachment,
container: message,
author: user,
filename: filename)
}
let!(:attachable_journal) {
FactoryGirl.create(:journal_attachable_journal,
FactoryBot.create(:journal_attachable_journal,
journal: message.journals.last,
attachment: attachment,
filename: filename)
@ -208,16 +208,16 @@ describe MessagesController, type: :controller do
end
it_behaves_like 'authorizes object access' do
let(:message) { FactoryGirl.create :message, board: board }
let(:message) { FactoryBot.create :message, board: board }
let(:preview_params) { { board_id: board.id, id: message.id, message: {} } }
end
end
describe 'quote' do
let(:message) { FactoryGirl.create :message, content: 'foo', subject: 'subject', board: board }
let(:message) { FactoryBot.create :message, content: 'foo', subject: 'subject', board: board }
context 'when allowed' do
let(:user) { FactoryGirl.create(:admin) }
let(:user) { FactoryBot.create(:admin) }
before do
login_as user

@ -29,7 +29,7 @@
require 'spec_helper'
describe MyController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:user) { FactoryBot.create(:user) }
before(:each) do
login_as(user)
end
@ -118,7 +118,7 @@ describe MyController, type: :controller do
end
describe 'account' do
let(:custom_field) { FactoryGirl.create :text_user_custom_field }
let(:custom_field) { FactoryBot.create :text_user_custom_field }
before do
custom_field
as_logged_in_user user do

@ -31,8 +31,8 @@ require 'spec_helper'
describe News::CommentsController, type: :controller do
render_views
let(:user) { FactoryGirl.create(:admin) }
let(:news) { FactoryGirl.create(:news) }
let(:user) { FactoryBot.create(:admin) }
let(:news) { FactoryBot.create(:news) }
before do
allow(User).to receive(:current).and_return user
@ -60,7 +60,7 @@ describe News::CommentsController, type: :controller do
describe '#destroy' do
it 'deletes the comment and redirects to the news page' do
comment = FactoryGirl.create :comment, commented: news
comment = FactoryBot.create :comment, commented: news
expect {
delete :destroy, params: { id: comment.id }

@ -34,14 +34,14 @@ describe NewsController, type: :controller do
include BecomeMember
let(:user) {
user = FactoryGirl.create(:admin)
user = FactoryBot.create(:admin)
FactoryGirl.create(:user_preference, user: user, others: { no_self_notified: false })
FactoryBot.create(:user_preference, user: user, others: { no_self_notified: false })
user
}
let(:project) { FactoryGirl.create(:project) }
let(:news) { FactoryGirl.create(:news) }
let(:project) { FactoryBot.create(:project) }
let(:news) { FactoryBot.create(:news) }
before do
allow(User).to receive(:current).and_return user

@ -29,7 +29,7 @@
require 'spec_helper'
describe PlanningElementTypeColorsController, type: :controller do
let(:current_user) { FactoryGirl.create(:admin) }
let(:current_user) { FactoryBot.create(:admin) }
before do
allow(User).to receive(:current).and_return current_user
@ -51,7 +51,7 @@ describe PlanningElementTypeColorsController, type: :controller do
describe 'create.html' do
def fetch
post 'create', params: { color: FactoryGirl.build(:color).attributes }
post 'create', params: { color: FactoryBot.build(:color).attributes }
end
def expect_redirect_to
@ -62,7 +62,7 @@ describe PlanningElementTypeColorsController, type: :controller do
describe 'edit.html' do
def fetch
@available_color = FactoryGirl.create(:color, id: '1337')
@available_color = FactoryBot.create(:color, id: '1337')
get 'edit', params: { id: '1337' }
end
it_should_behave_like 'a controller action with require_admin'
@ -70,7 +70,7 @@ describe PlanningElementTypeColorsController, type: :controller do
describe 'update.html' do
def fetch
@available_color = FactoryGirl.create(:color, id: '1337')
@available_color = FactoryBot.create(:color, id: '1337')
put 'update', params: { id: '1337', color: { 'name' => 'blubs' } }
end
@ -82,7 +82,7 @@ describe PlanningElementTypeColorsController, type: :controller do
describe 'move.html' do
def fetch
@available_color = FactoryGirl.create(:color, id: '1337')
@available_color = FactoryBot.create(:color, id: '1337')
post 'move', params: { id: '1337', color: { move_to: 'highest' } }
end
@ -94,7 +94,7 @@ describe PlanningElementTypeColorsController, type: :controller do
describe 'confirm_destroy.html' do
def fetch
@available_color = FactoryGirl.create(:color, id: '1337')
@available_color = FactoryBot.create(:color, id: '1337')
get 'confirm_destroy', params: { id: '1337' }
end
it_should_behave_like 'a controller action with require_admin'
@ -102,7 +102,7 @@ describe PlanningElementTypeColorsController, type: :controller do
describe 'destroy.html' do
def fetch
@available_color = FactoryGirl.create(:color, id: '1337')
@available_color = FactoryBot.create(:color, id: '1337')
post 'destroy', params: { id: '1337' }
end

@ -29,7 +29,7 @@
require 'spec_helper'
describe ProjectTypesController, type: :controller do
let(:current_user) { FactoryGirl.create(:admin) }
let(:current_user) { FactoryBot.create(:admin) }
before do
allow(User).to receive(:current).and_return current_user
@ -51,7 +51,7 @@ describe ProjectTypesController, type: :controller do
describe 'create.html' do
def fetch
post 'create', params: { project_type: FactoryGirl.build(:project_type).attributes }
post 'create', params: { project_type: FactoryBot.build(:project_type).attributes }
end
def expect_redirect_to
@ -62,7 +62,7 @@ describe ProjectTypesController, type: :controller do
describe 'edit.html' do
def fetch
FactoryGirl.create(:project_type, id: '1337')
FactoryBot.create(:project_type, id: '1337')
get 'edit', params: { id: '1337' }
end
it_should_behave_like 'a controller action with require_admin'
@ -70,7 +70,7 @@ describe ProjectTypesController, type: :controller do
describe 'update.html' do
def fetch
FactoryGirl.create(:project_type, id: '1337')
FactoryBot.create(:project_type, id: '1337')
put 'update', params: { id: '1337', project_type: { 'name' => 'blubs' } }
end
@ -82,7 +82,7 @@ describe ProjectTypesController, type: :controller do
describe 'move.html' do
def fetch
FactoryGirl.create(:project_type, id: '1337')
FactoryBot.create(:project_type, id: '1337')
post 'move', params: { id: '1337', project_type: { move_to: 'highest' } }
end
@ -94,7 +94,7 @@ describe ProjectTypesController, type: :controller do
describe 'confirm_destroy.html' do
def fetch
FactoryGirl.create(:project_type, id: '1337')
FactoryBot.create(:project_type, id: '1337')
get 'confirm_destroy', params: { id: '1337' }
end
it_should_behave_like 'a controller action with require_admin'
@ -102,7 +102,7 @@ describe ProjectTypesController, type: :controller do
describe 'destroy.html' do
def fetch
FactoryGirl.create(:project_type, id: '1337')
FactoryBot.create(:project_type, id: '1337')
post 'destroy', params: { id: '1337' }
end

@ -37,8 +37,8 @@ describe ProjectsController, type: :controller do
before do
allow(@controller).to receive(:set_localization)
@role = FactoryGirl.create(:non_member)
@user = FactoryGirl.create(:admin)
@role = FactoryBot.create(:non_member)
@user = FactoryBot.create(:admin)
allow(User).to receive(:current).and_return @user
@params = {}
@ -49,7 +49,7 @@ describe ProjectsController, type: :controller do
describe 'without wiki' do
before do
@project = FactoryGirl.create(:project)
@project = FactoryBot.create(:project)
@project.reload # project contains wiki by default
@project.wiki.destroy
@project.reload
@ -71,7 +71,7 @@ describe ProjectsController, type: :controller do
describe 'with wiki' do
before do
@project = FactoryGirl.create(:project)
@project = FactoryBot.create(:project)
@project.reload # project contains wiki by default
@params[:id] = @project.id
end
@ -92,8 +92,8 @@ describe ProjectsController, type: :controller do
describe 'with custom wiki menu item' do
before do
main_item = FactoryGirl.create(:wiki_menu_item, navigatable_id: @project.wiki.id, name: 'example', title: 'Example Title')
sub_item = FactoryGirl.create(:wiki_menu_item, navigatable_id: @project.wiki.id, name: 'sub', title: 'Sub Title', parent_id: main_item.id)
main_item = FactoryBot.create(:wiki_menu_item, navigatable_id: @project.wiki.id, name: 'example', title: 'Example Title')
sub_item = FactoryBot.create(:wiki_menu_item, navigatable_id: @project.wiki.id, name: 'sub', title: 'Sub Title', parent_id: main_item.id)
end
it 'renders show' do
@ -118,7 +118,7 @@ describe ProjectsController, type: :controller do
describe 'with activated activity module' do
before do
@project = FactoryGirl.create(:project, enabled_module_names: %w[activity])
@project = FactoryBot.create(:project, enabled_module_names: %w[activity])
@params[:id] = @project.id
end
@ -136,7 +136,7 @@ describe ProjectsController, type: :controller do
describe 'without activated activity module' do
before do
@project = FactoryGirl.create(:project, enabled_module_names: %w[wiki])
@project = FactoryBot.create(:project, enabled_module_names: %w[wiki])
@params[:id] = @project.id
end
@ -162,10 +162,10 @@ describe ProjectsController, type: :controller do
end
describe 'index.html' do
let(:project_a) { FactoryGirl.create(:project, name: 'Project A', is_public: false, status: true) }
let(:project_b) { FactoryGirl.create(:project, name: 'Project B', is_public: false, status: true) }
let(:project_c) { FactoryGirl.create(:project, name: 'Project C', is_public: true, status: true) }
let(:project_d) { FactoryGirl.create(:project, name: 'Project D', is_public: true, status: false) }
let(:project_a) { FactoryBot.create(:project, name: 'Project A', is_public: false, status: true) }
let(:project_b) { FactoryBot.create(:project, name: 'Project B', is_public: false, status: true) }
let(:project_c) { FactoryBot.create(:project, name: 'Project C', is_public: true, status: true) }
let(:project_d) { FactoryBot.create(:project, name: 'Project D', is_public: true, status: false) }
let(:projects) { [project_a, project_b, project_c, project_d] }
@ -187,7 +187,7 @@ describe ProjectsController, type: :controller do
end
context 'as admin' do
let(:user) { FactoryGirl.build(:admin) }
let(:user) { FactoryBot.build(:admin) }
it_behaves_like 'successful index'
@ -209,7 +209,7 @@ describe ProjectsController, type: :controller do
end
context 'as user' do
let(:user) { FactoryGirl.build(:user, member_in_project: project_b) }
let(:user) { FactoryBot.build(:user, member_in_project: project_b) }
it_behaves_like 'successful index'
@ -221,7 +221,7 @@ describe ProjectsController, type: :controller do
end
describe 'index.html' do
let(:user) { FactoryGirl.build(:admin) }
let(:user) { FactoryBot.build(:admin) }
before do
login_as(user)
@ -245,9 +245,9 @@ describe ProjectsController, type: :controller do
service
end
let(:user) { FactoryGirl.create(:admin) }
let(:user) { FactoryBot.create(:admin) }
let(:project) do
project = FactoryGirl.build_stubbed(:project)
project = FactoryBot.build_stubbed(:project)
allow(Project).to receive(:find).and_return(project)
@ -296,9 +296,9 @@ describe ProjectsController, type: :controller do
end
describe '#custom_fields' do
let(:project) { FactoryGirl.create(:project) }
let(:custom_field_1) { FactoryGirl.create(:work_package_custom_field) }
let(:custom_field_2) { FactoryGirl.create(:work_package_custom_field) }
let(:project) { FactoryBot.create(:project) }
let(:custom_field_1) { FactoryBot.create(:work_package_custom_field) }
let(:custom_field_2) { FactoryBot.create(:work_package_custom_field) }
let(:params) do
{

@ -31,20 +31,20 @@ require 'spec_helper'
describe RepositoriesController, type: :controller do
let(:project) do
project = FactoryGirl.create(:project)
project = FactoryBot.create(:project)
allow(Project).to receive(:find).and_return(project)
project
end
let(:user) do
FactoryGirl.create(:user, member_in_project: project,
FactoryBot.create(:user, member_in_project: project,
member_through_role: role)
end
let(:role) { FactoryGirl.create(:role, permissions: []) }
let(:role) { FactoryBot.create(:role, permissions: []) }
let (:url) { 'file:///tmp/something/does/not/exist.svn' }
let(:repository) do
allow(Setting).to receive(:enabled_scm).and_return(['subversion'])
repo = FactoryGirl.build_stubbed(:repository_subversion,
repo = FactoryBot.build_stubbed(:repository_subversion,
scm_type: 'local',
url: url,
project: project)
@ -61,7 +61,7 @@ describe RepositoriesController, type: :controller do
end
describe 'manages the repository' do
let(:role) { FactoryGirl.create(:role, permissions: [:manage_repository]) }
let(:role) { FactoryBot.create(:role, permissions: [:manage_repository]) }
before do
# authorization checked in spec/permissions/manage_repositories_spec.rb
@ -107,7 +107,7 @@ describe RepositoriesController, type: :controller do
end
describe 'with empty repository' do
let(:role) { FactoryGirl.create(:role, permissions: [:browse_repository]) }
let(:role) { FactoryBot.create(:role, permissions: [:browse_repository]) }
before do
allow(repository.scm)
.to receive(:check_availability!)
@ -155,7 +155,7 @@ describe RepositoriesController, type: :controller do
let(:url) { "file://#{root_url}" }
let(:repository) {
FactoryGirl.create(:repository_subversion, project: project, url: url, root_url: url)
FactoryBot.create(:repository_subversion, project: project, url: url, root_url: url)
}
describe 'commits per author graph' do
@ -165,7 +165,7 @@ describe RepositoriesController, type: :controller do
context 'requested by an authorized user' do
let(:role) {
FactoryGirl.create(:role, permissions: [:browse_repository,
FactoryBot.create(:role, permissions: [:browse_repository,
:view_commit_author_statistics])
}
@ -179,7 +179,7 @@ describe RepositoriesController, type: :controller do
end
context 'requested by an unauthorized user' do
let(:role) { FactoryGirl.create(:role, permissions: [:browse_repository]) }
let(:role) { FactoryBot.create(:role, permissions: [:browse_repository]) }
it 'should return 403' do
expect(response.code).to eq('403')
@ -188,7 +188,7 @@ describe RepositoriesController, type: :controller do
end
describe 'committers' do
let(:role) { FactoryGirl.create(:role, permissions: [:manage_repository]) }
let(:role) { FactoryBot.create(:role, permissions: [:manage_repository]) }
describe '#get' do
before do
@ -222,7 +222,7 @@ describe RepositoriesController, type: :controller do
describe 'requested by a user with view_commit_author_statistics permission' do
let(:role) {
FactoryGirl.create(:role, permissions: [:browse_repository,
FactoryBot.create(:role, permissions: [:browse_repository,
:view_commit_author_statistics])
}
@ -232,7 +232,7 @@ describe RepositoriesController, type: :controller do
end
describe 'requested by a user without view_commit_author_statistics permission' do
let(:role) { FactoryGirl.create(:role, permissions: [:browse_repository]) }
let(:role) { FactoryBot.create(:role, permissions: [:browse_repository]) }
it 'should NOT show the commits per author graph' do
expect(assigns(:show_commits_per_author)).to eq(false)
@ -249,7 +249,7 @@ describe RepositoriesController, type: :controller do
describe 'show' do
render_views
let(:role) { FactoryGirl.create(:role, permissions: [:browse_repository]) }
let(:role) { FactoryBot.create(:role, permissions: [:browse_repository]) }
before do
get :show, params: { project_id: project.identifier, repo_path: path }
@ -268,7 +268,7 @@ describe RepositoriesController, type: :controller do
describe 'changes' do
render_views
let(:role) { FactoryGirl.create(:role, permissions: [:browse_repository]) }
let(:role) { FactoryBot.create(:role, permissions: [:browse_repository]) }
before do
get :changes, params: { project_id: project.identifier, repo_path: path }
@ -289,7 +289,7 @@ describe RepositoriesController, type: :controller do
describe 'checkout path' do
render_views
let(:role) { FactoryGirl.create(:role, permissions: [:browse_repository]) }
let(:role) { FactoryBot.create(:role, permissions: [:browse_repository]) }
let(:checkout_hash) {
{
'subversion' => { 'enabled' => '1',
@ -316,7 +316,7 @@ describe RepositoriesController, type: :controller do
end
describe 'when not being logged in' do
let(:anonymous) { FactoryGirl.build_stubbed(:anonymous) }
let(:anonymous) { FactoryBot.build_stubbed(:anonymous) }
before do
login_as(anonymous)

@ -30,11 +30,11 @@ require 'spec_helper'
describe SearchController, type: :controller do
let!(:project) {
FactoryGirl.create(:project,
FactoryBot.create(:project,
name: 'eCookbook')
}
let(:user) {
FactoryGirl.create(:user,
FactoryBot.create(:user,
member_in_project: project)
}
@ -62,7 +62,7 @@ describe SearchController, type: :controller do
end
context 'is a work package reference' do
let!(:work_package) { FactoryGirl.create :work_package, project: project }
let!(:work_package) { FactoryBot.create :work_package, project: project }
subject { get :index, params: { q: "##{work_package.id}" } }
@ -81,15 +81,15 @@ describe SearchController, type: :controller do
describe 'work package search' do
let!(:work_package_1) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
subject: 'This is a test issue',
project: project)
}
let!(:work_package_2) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
subject: 'Issue test 2',
project: project,
status: FactoryGirl.create(:closed_status))
status: FactoryBot.create(:closed_status))
}
context 'when not searching for a note' do
@ -118,7 +118,7 @@ describe SearchController, type: :controller do
context 'when searching for a note' do
let!(:note_1) {
FactoryGirl.create :work_package_journal,
FactoryBot.create :work_package_journal,
journable_id: work_package_1.id,
notes: 'Test note 1',
version: 2
@ -127,7 +127,7 @@ describe SearchController, type: :controller do
before do allow_any_instance_of(Journal).to receive_messages(predecessor: note_1) end
let!(:note_2) {
FactoryGirl.create :work_package_journal,
FactoryBot.create :work_package_journal,
journable_id: work_package_1.id,
notes: 'Special note 2',
version: 3

@ -33,7 +33,7 @@ describe SettingsController, type: :controller do
allow(@controller).to receive(:set_localization)
@params = {}
@user = FactoryGirl.create(:admin)
@user = FactoryBot.create(:admin)
allow(User).to receive(:current).and_return @user
end

@ -29,8 +29,8 @@
require 'spec_helper'
describe StatusesController, type: :controller do
let(:user) { FactoryGirl.create(:admin) }
let(:status) { FactoryGirl.create(:status) }
let(:user) { FactoryBot.create(:admin) }
let(:status) { FactoryBot.create(:status) }
before do allow(User).to receive(:current).and_return user end
@ -90,7 +90,7 @@ describe StatusesController, type: :controller do
context 'default' do
let!(:status_default) {
FactoryGirl.create(:status,
FactoryBot.create(:status,
is_default: true)
}
@ -172,7 +172,7 @@ describe StatusesController, type: :controller do
context 'used' do
let(:work_package) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
status: status)
}
@ -189,7 +189,7 @@ describe StatusesController, type: :controller do
context 'default' do
let!(:status_default) {
FactoryGirl.create(:status,
FactoryBot.create(:status,
is_default: true)
}

@ -30,13 +30,13 @@ require 'spec_helper'
describe SysController, type: :controller do
let(:commit_role) {
FactoryGirl.create(:role, permissions: %i[commit_access browse_repository])
FactoryBot.create(:role, permissions: %i[commit_access browse_repository])
}
let(:browse_role) { FactoryGirl.create(:role, permissions: [:browse_repository]) }
let(:guest_role) { FactoryGirl.create(:role, permissions: []) }
let(:browse_role) { FactoryBot.create(:role, permissions: [:browse_repository]) }
let(:guest_role) { FactoryBot.create(:role, permissions: []) }
let(:valid_user_password) { 'Top Secret Password' }
let(:valid_user) {
FactoryGirl.create(:user,
FactoryBot.create(:user,
login: 'johndoe',
password: valid_user_password,
password_confirmation: valid_user_password)
@ -45,14 +45,14 @@ describe SysController, type: :controller do
let(:api_key) { '12345678' }
let(:public) { false }
let(:project) { FactoryGirl.create(:project, is_public: public) }
let(:project) { FactoryBot.create(:project, is_public: public) }
before(:each) do
FactoryGirl.create(:non_member, permissions: [:browse_repository])
FactoryBot.create(:non_member, permissions: [:browse_repository])
DeletedUser.first # creating it first in order to avoid problems with should_receive
random_project = FactoryGirl.create(:project, is_public: false)
FactoryGirl.create(:member,
random_project = FactoryBot.create(:project, is_public: false)
FactoryBot.create(:member,
user: valid_user,
roles: [browse_role],
project: random_project)
@ -65,7 +65,7 @@ describe SysController, type: :controller do
end
describe 'svn' do
let!(:repository) { FactoryGirl.create(:repository_subversion, project: project) }
let!(:repository) { FactoryBot.create(:repository_subversion, project: project) }
describe 'repo_auth' do
context 'for valid login, but no access to repo_auth' do
@ -89,7 +89,7 @@ describe SysController, type: :controller do
context 'for valid login and user has read permission (role reporter) for project' do
before(:each) do
FactoryGirl.create(:member,
FactoryBot.create(:member,
user: valid_user,
roles: [browse_role],
project: project)
@ -120,7 +120,7 @@ describe SysController, type: :controller do
context 'for valid login and user has rw permission (role developer) for project' do
before(:each) do
FactoryGirl.create(:member,
FactoryBot.create(:member,
user: valid_user,
roles: [commit_role],
project: project)
@ -151,7 +151,7 @@ describe SysController, type: :controller do
context 'for invalid login and user has role manager for project' do
before(:each) do
FactoryGirl.create(:member,
FactoryBot.create(:member,
user: valid_user,
roles: [commit_role],
project: project)
@ -193,8 +193,8 @@ describe SysController, type: :controller do
let(:public) { true }
before(:each) do
random_project = FactoryGirl.create(:project, is_public: false)
FactoryGirl.create(:member,
random_project = FactoryBot.create(:project, is_public: false)
FactoryBot.create(:member,
user: valid_user,
roles: [browse_role],
project: random_project)
@ -264,7 +264,7 @@ describe SysController, type: :controller do
end
describe 'git' do
let!(:repository) { FactoryGirl.create(:repository_git, project: project) }
let!(:repository) { FactoryBot.create(:repository_git, project: project) }
describe 'repo_auth' do
context 'for valid login, but no access to repo_auth' do
before(:each) do
@ -290,7 +290,7 @@ describe SysController, type: :controller do
context 'for valid login and user has read permission (role reporter) for project' do
before(:each) do
FactoryGirl.create(:member,
FactoryBot.create(:member,
user: valid_user,
roles: [browse_role],
project: project)
@ -327,7 +327,7 @@ describe SysController, type: :controller do
context 'for valid login and user has rw permission (role developer) for project' do
before(:each) do
FactoryGirl.create(:member,
FactoryBot.create(:member,
user: valid_user,
roles: [commit_role],
project: project)
@ -365,7 +365,7 @@ describe SysController, type: :controller do
context 'for invalid login and user has role manager for project' do
before(:each) do
FactoryGirl.create(:member,
FactoryBot.create(:member,
user: valid_user,
roles: [commit_role],
project: project)
@ -391,7 +391,7 @@ describe SysController, type: :controller do
context 'for valid login and user is not member for project' do
before(:each) do
project = FactoryGirl.create(:project, is_public: false)
project = FactoryBot.create(:project, is_public: false)
request.env['HTTP_AUTHORIZATION'] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
@ -414,8 +414,8 @@ describe SysController, type: :controller do
context 'for valid login and project is public' do
let(:public) { true }
before(:each) do
random_project = FactoryGirl.create(:project, is_public: false)
FactoryGirl.create(:member,
random_project = FactoryBot.create(:project, is_public: false)
FactoryBot.create(:member,
user: valid_user,
roles: [browse_role],
project: random_project)
@ -562,7 +562,7 @@ describe SysController, type: :controller do
end
context 'available project, but missing repository' do
let(:project) { FactoryGirl.build_stubbed(:project) }
let(:project) { FactoryBot.build_stubbed(:project) }
let(:id) { project.id }
before do
allow(Project).to receive(:find).and_return(project)
@ -576,10 +576,10 @@ describe SysController, type: :controller do
end
context 'stubbed repository' do
let(:project) { FactoryGirl.build_stubbed(:project) }
let(:project) { FactoryBot.build_stubbed(:project) }
let(:id) { project.id }
let(:repository) {
FactoryGirl.build_stubbed(:repository_subversion, url: url, root_url: url)
FactoryBot.build_stubbed(:repository_subversion, url: url, root_url: url)
}
before do
@ -617,10 +617,10 @@ describe SysController, type: :controller do
let(:root_url) { repo_dir }
let(:url) { "file://#{root_url}" }
let(:project) { FactoryGirl.create(:project) }
let(:project) { FactoryBot.create(:project) }
let(:id) { project.id }
let(:repository) {
FactoryGirl.create(:repository_subversion, project: project, url: url, root_url: url)
FactoryBot.create(:repository_subversion, project: project, url: url, root_url: url)
}
before do

@ -29,10 +29,10 @@
require 'spec_helper'
describe TimelogController, type: :controller do
let!(:activity) { FactoryGirl.create(:default_activity) }
let(:project) { FactoryGirl.create(:project) }
let!(:activity) { FactoryBot.create(:default_activity) }
let(:project) { FactoryBot.create(:project) }
let(:user) do
FactoryGirl.create(:admin,
FactoryBot.create(:admin,
member_in_project: project)
end
let(:params) do
@ -78,7 +78,7 @@ describe TimelogController, type: :controller do
context 'with a required custom field' do
let(:custom_field) do
FactoryGirl.build_stubbed :time_entry_custom_field,
FactoryBot.build_stubbed :time_entry_custom_field,
name: 'supplies',
is_required: true
end
@ -110,7 +110,7 @@ describe TimelogController, type: :controller do
context 'work_package' do
describe '#valid' do
let(:work_package) do
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
project: project)
end
let(:work_package_id) { work_package.id }

@ -30,20 +30,20 @@ require 'spec_helper'
describe TypesController, type: :controller do
let(:project) do
FactoryGirl.create(:project,
FactoryBot.create(:project,
work_package_custom_fields: [custom_field_2])
end
let(:custom_field_1) do
FactoryGirl.create(:work_package_custom_field,
FactoryBot.create(:work_package_custom_field,
field_format: 'string',
is_for_all: true)
end
let(:custom_field_2) { FactoryGirl.create(:work_package_custom_field) }
let(:status_0) { FactoryGirl.create(:status) }
let(:status_1) { FactoryGirl.create(:status) }
let(:custom_field_2) { FactoryBot.create(:work_package_custom_field) }
let(:status_0) { FactoryBot.create(:status) }
let(:status_1) { FactoryBot.create(:status) }
context 'with an unauthorized account' do
let(:current_user) { FactoryGirl.create(:user) }
let(:current_user) { FactoryBot.create(:user) }
before do
allow(User).to receive(:current).and_return(current_user)
@ -107,7 +107,7 @@ describe TypesController, type: :controller do
end
context 'with an authorized account' do
let(:current_user) { FactoryGirl.create(:admin) }
let(:current_user) { FactoryBot.create(:admin) }
before do
allow(User).to receive(:current).and_return(current_user)
@ -165,9 +165,9 @@ describe TypesController, type: :controller do
end
describe 'WITH workflow copy' do
let!(:existing_type) { FactoryGirl.create(:type, name: 'Existing type') }
let!(:existing_type) { FactoryBot.create(:type, name: 'Existing type') }
let!(:workflow) do
FactoryGirl.create(:workflow,
FactoryBot.create(:workflow,
old_status: status_0,
new_status: status_1,
type_id: existing_type.id)
@ -199,7 +199,7 @@ describe TypesController, type: :controller do
describe 'GET edit settings' do
render_views
let(:type) do
FactoryGirl.create(:type, name: 'My type',
FactoryBot.create(:type, name: 'My type',
is_milestone: true,
projects: [project])
end
@ -218,7 +218,7 @@ describe TypesController, type: :controller do
describe 'GET edit projects' do
render_views
let(:type) do
FactoryGirl.create(:type, name: 'My type',
FactoryBot.create(:type, name: 'My type',
is_milestone: true,
projects: [project])
end
@ -234,9 +234,9 @@ describe TypesController, type: :controller do
end
describe 'POST update' do
let(:project2) { FactoryGirl.create(:project) }
let(:project2) { FactoryBot.create(:project) }
let(:type) do
FactoryGirl.create(:type, name: 'My type',
FactoryBot.create(:type, name: 'My type',
is_milestone: true,
projects: [project, project2])
end
@ -287,8 +287,8 @@ describe TypesController, type: :controller do
end
describe 'POST move' do
let!(:type) { FactoryGirl.create(:type, name: 'My type', position: '1') }
let!(:type2) { FactoryGirl.create(:type, name: 'My type 2', position: '2') }
let!(:type) { FactoryBot.create(:type, name: 'My type', position: '1') }
let!(:type2) { FactoryBot.create(:type, name: 'My type 2', position: '2') }
let(:params) { { 'id' => type.id, 'type' => { move_to: 'lower' } } }
before do
@ -303,9 +303,9 @@ describe TypesController, type: :controller do
end
describe 'DELETE destroy' do
let(:type) { FactoryGirl.create(:type, name: 'My type') }
let(:type2) { FactoryGirl.create(:type, name: 'My type 2', projects: [project]) }
let(:type3) { FactoryGirl.create(:type, name: 'My type 3', is_standard: true) }
let(:type) { FactoryBot.create(:type, name: 'My type') }
let(:type2) { FactoryBot.create(:type, name: 'My type 2', projects: [project]) }
let(:type3) { FactoryBot.create(:type, name: 'My type 3', is_standard: true) }
describe 'successful detroy' do
let(:params) { { 'id' => type.id } }
@ -326,12 +326,12 @@ describe TypesController, type: :controller do
describe 'detroy type in use should fail' do
let(:project2) do
FactoryGirl.create(:project,
FactoryBot.create(:project,
work_package_custom_fields: [custom_field_2],
types: [type2])
end
let!(:work_package) do
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
author: current_user,
type: type2,
project: project2)

@ -30,13 +30,13 @@ require 'spec_helper'
require 'work_package'
describe Users::MembershipsController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:admin) { FactoryGirl.create(:admin) }
let(:anonymous) { FactoryGirl.create(:anonymous) }
let(:user) { FactoryBot.create(:user) }
let(:admin) { FactoryBot.create(:admin) }
let(:anonymous) { FactoryBot.create(:anonymous) }
describe 'update memberships' do
let(:project) { FactoryGirl.create(:project) }
let(:role) { FactoryGirl.create(:role) }
let(:project) { FactoryBot.create(:project) }
let(:role) { FactoryBot.create(:role) }
it 'works' do
# i.e. it should successfully add a user to a project's members

@ -40,14 +40,14 @@ describe UsersController, type: :controller do
let(:user_password) {'bob!' * 4}
let(:user) do
FactoryGirl.create(:user,
FactoryBot.create(:user,
login: 'bob',
password: user_password,
password_confirmation: user_password,
)
end
let(:admin) { FactoryGirl.create(:admin) }
let(:anonymous) { FactoryGirl.create(:anonymous) }
let(:admin) { FactoryBot.create(:admin) }
let(:anonymous) { FactoryBot.create(:anonymous) }
describe 'GET deletion_info' do
describe "WHEN the current user is the requested user
@ -133,10 +133,10 @@ describe UsersController, type: :controller do
end
describe 'POST resend_invitation' do
let(:invited_user) { FactoryGirl.create :invited_user }
let(:invited_user) { FactoryBot.create :invited_user }
context 'without admin rights' do
let(:normal_user) { FactoryGirl.create :user }
let(:normal_user) { FactoryBot.create :user }
before do
as_logged_in_user normal_user do
@ -150,7 +150,7 @@ describe UsersController, type: :controller do
end
context 'with admin rights' do
let(:admin_user) { FactoryGirl.create :admin }
let(:admin_user) { FactoryBot.create :admin }
before do
expect(ActionMailer::Base.deliveries).to be_empty
@ -245,7 +245,7 @@ describe UsersController, type: :controller do
describe "WHEN the current user is the admin
WHEN the given password does not match
WHEN the setting users_deletable_by_admins is set to true" do
let(:admin) { FactoryGirl.create(:admin) }
let(:admin) { FactoryBot.create(:admin) }
before do
disable_flash_sweep
@ -269,7 +269,7 @@ describe UsersController, type: :controller do
let(:admin_password) {'admin!' * 4}
let(:admin) do
FactoryGirl.create(:admin,
FactoryBot.create(:admin,
password: admin_password,
password_confirmation: admin_password)
end
@ -289,7 +289,7 @@ describe UsersController, type: :controller do
describe "WHEN the current user is the admin
WHEN the setting users_deletable_by_admins is set to false" do
let(:admin) { FactoryGirl.create(:admin) }
let(:admin) { FactoryBot.create(:admin) }
before do
disable_flash_sweep
@ -307,7 +307,7 @@ describe UsersController, type: :controller do
describe '#change_status_info' do
let!(:registered_user) do
FactoryGirl.create(:user, status: User::STATUSES[:registered])
FactoryBot.create(:user, status: User::STATUSES[:registered])
end
before do
@ -360,7 +360,7 @@ describe UsersController, type: :controller do
} do
describe 'WHEN activating a registered user' do
let!(:registered_user) do
FactoryGirl.create(:user, status: User::STATUSES[:registered],
FactoryBot.create(:user, status: User::STATUSES[:registered],
language: 'de')
end
@ -495,7 +495,7 @@ describe UsersController, type: :controller do
describe 'update' do
context 'fields' do
let(:user) {
FactoryGirl.create(:user, firstname: 'Firstname',
FactoryBot.create(:user, firstname: 'Firstname',
admin: true,
login: 'testlogin',
mail_notification: 'all',
@ -545,7 +545,7 @@ describe UsersController, type: :controller do
end
context 'with external authentication' do
let(:user) { FactoryGirl.create(:user, identity_url: 'some:identity') }
let(:user) { FactoryBot.create(:user, identity_url: 'some:identity') }
before do
as_logged_in_user(admin) do
@ -560,7 +560,7 @@ describe UsersController, type: :controller do
end
context 'ldap auth source' do
let(:ldap_auth_source) { FactoryGirl.create(:ldap_auth_source) }
let(:ldap_auth_source) { FactoryBot.create(:ldap_auth_source) }
it 'switchting to internal authentication on a password change' do
user.auth_source = ldap_auth_source
@ -638,33 +638,33 @@ describe UsersController, type: :controller do
render_views
let(:work_package) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
author: user)
}
let!(:member) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: work_package.project,
principal: user,
roles: [FactoryGirl.create(:role,
roles: [FactoryBot.create(:role,
permissions: [:view_work_packages])])
}
let!(:journal_1) {
FactoryGirl.create(:work_package_journal,
FactoryBot.create(:work_package_journal,
user: user,
journable_id: work_package.id,
version: Journal.maximum(:version) + 1,
data: FactoryGirl.build(:journal_work_package_journal,
data: FactoryBot.build(:journal_work_package_journal,
subject: work_package.subject,
status_id: work_package.status_id,
type_id: work_package.type_id,
project_id: work_package.project_id))
}
let!(:journal_2) {
FactoryGirl.create(:work_package_journal,
FactoryBot.create(:work_package_journal,
user: user,
journable_id: work_package.id,
version: Journal.maximum(:version) + 1,
data: FactoryGirl.build(:journal_work_package_journal,
data: FactoryBot.build(:journal_work_package_journal,
subject: work_package.subject,
status_id: work_package.status_id,
type_id: work_package.type_id,

@ -29,11 +29,11 @@
require 'spec_helper'
describe VersionsController, type: :controller do
let(:user) { FactoryGirl.create(:admin) }
let(:project) { FactoryGirl.create(:public_project) }
let(:version1) { FactoryGirl.create(:version, project: project, effective_date: nil) }
let(:version2) { FactoryGirl.create(:version, project: project) }
let(:version3) { FactoryGirl.create(:version, project: project, effective_date: (Date.today - 14.days)) }
let(:user) { FactoryBot.create(:admin) }
let(:project) { FactoryBot.create(:public_project) }
let(:version1) { FactoryBot.create(:version, project: project, effective_date: nil) }
let(:version2) { FactoryBot.create(:version, project: project) }
let(:version3) { FactoryBot.create(:version, project: project, effective_date: (Date.today - 14.days)) }
describe '#index' do
render_views
@ -87,8 +87,8 @@ describe VersionsController, type: :controller do
end
context 'with showing subprojects versions' do
let(:sub_project) { FactoryGirl.create(:public_project, parent_id: project.id) }
let(:version4) { FactoryGirl.create(:version, project: sub_project) }
let(:sub_project) { FactoryBot.create(:public_project, parent_id: project.id) }
let(:version4) { FactoryBot.create(:version, project: sub_project) }
before do
login_as(user)

@ -39,20 +39,20 @@ describe WikiController, type: :controller do
before do
allow(@controller).to receive(:set_localization)
@role = FactoryGirl.create(:non_member)
@user = FactoryGirl.create(:admin)
@role = FactoryBot.create(:non_member)
@user = FactoryBot.create(:admin)
allow(User).to receive(:current).and_return @user
@project = FactoryGirl.create(:project)
@project = FactoryBot.create(:project)
@project.reload # to get the wiki into the proxy
# creating pages
@existing_page = FactoryGirl.create(:wiki_page, wiki_id: @project.wiki.id,
@existing_page = FactoryBot.create(:wiki_page, wiki_id: @project.wiki.id,
title: 'ExistingPage')
# creating page contents
FactoryGirl.create(:wiki_content, page_id: @existing_page.id,
FactoryBot.create(:wiki_content, page_id: @existing_page.id,
author_id: @user.id)
end
@ -201,7 +201,7 @@ describe WikiController, type: :controller do
let(:redirect_page_after_destroy) { wiki.find_page(wiki.start_page) || wiki.pages.first }
before do
another_wiki_page = FactoryGirl.create :wiki_page, wiki: wiki
another_wiki_page = FactoryBot.create :wiki_page, wiki: wiki
end
it 'redirects to wiki#index' do
@ -227,44 +227,44 @@ describe WikiController, type: :controller do
allow(@controller).to receive(:set_localization)
allow(Setting).to receive(:login_required?).and_return(false)
@role = FactoryGirl.create(:non_member)
@user = FactoryGirl.create(:admin)
@role = FactoryBot.create(:non_member)
@user = FactoryBot.create(:admin)
@anon = User.anonymous.nil? ? FactoryGirl.create(:anonymous) : User.anonymous
@anon = User.anonymous.nil? ? FactoryBot.create(:anonymous) : User.anonymous
Role.anonymous.update_attributes name: I18n.t(:default_role_anonymous),
permissions: [:view_wiki_pages]
allow(User).to receive(:current).and_return @user
@project = FactoryGirl.create(:public_project)
@project = FactoryBot.create(:public_project)
@project.reload # to get the wiki into the proxy
# creating pages
@page_default = FactoryGirl.create(:wiki_page, wiki_id: @project.wiki.id,
@page_default = FactoryBot.create(:wiki_page, wiki_id: @project.wiki.id,
title: 'Wiki')
@page_with_content = FactoryGirl.create(:wiki_page, wiki_id: @project.wiki.id,
@page_with_content = FactoryBot.create(:wiki_page, wiki_id: @project.wiki.id,
title: 'PagewithContent')
@page_without_content = FactoryGirl.create(:wiki_page, wiki_id: @project.wiki.id,
@page_without_content = FactoryBot.create(:wiki_page, wiki_id: @project.wiki.id,
title: 'PagewithoutContent')
@unrelated_page = FactoryGirl.create(:wiki_page, wiki_id: @project.wiki.id,
@unrelated_page = FactoryBot.create(:wiki_page, wiki_id: @project.wiki.id,
title: 'UnrelatedPage')
# creating page contents
FactoryGirl.create(:wiki_content, page_id: @page_default.id,
FactoryBot.create(:wiki_content, page_id: @page_default.id,
author_id: @user.id)
FactoryGirl.create(:wiki_content, page_id: @page_with_content.id,
FactoryBot.create(:wiki_content, page_id: @page_with_content.id,
author_id: @user.id)
FactoryGirl.create(:wiki_content, page_id: @unrelated_page.id,
FactoryBot.create(:wiki_content, page_id: @unrelated_page.id,
author_id: @user.id)
# creating some child pages
@children = {}
[@page_with_content].each do |page|
child_page = FactoryGirl.create(:wiki_page, wiki_id: @project.wiki.id,
child_page = FactoryBot.create(:wiki_page, wiki_id: @project.wiki.id,
parent_id: page.id,
title: page.title + ' child')
FactoryGirl.create(:wiki_content, page_id: child_page.id,
FactoryBot.create(:wiki_content, page_id: child_page.id,
author_id: @user.id)
@children[page] = child_page
@ -273,15 +273,15 @@ describe WikiController, type: :controller do
describe '- main menu links' do
before do
@main_menu_item_for_page_with_content = FactoryGirl.create(:wiki_menu_item, navigatable_id: @project.wiki.id,
@main_menu_item_for_page_with_content = FactoryBot.create(:wiki_menu_item, navigatable_id: @project.wiki.id,
title: 'Item for Page with Content',
name: @page_with_content.slug)
@main_menu_item_for_new_wiki_page = FactoryGirl.create(:wiki_menu_item, navigatable_id: @project.wiki.id,
@main_menu_item_for_new_wiki_page = FactoryBot.create(:wiki_menu_item, navigatable_id: @project.wiki.id,
title: 'Item for new WikiPage',
name: 'new-wiki-page')
@other_menu_item = FactoryGirl.create(:wiki_menu_item, navigatable_id: @project.wiki.id,
@other_menu_item = FactoryBot.create(:wiki_menu_item, navigatable_id: @project.wiki.id,
title: 'Item for other page',
name: @unrelated_page.slug)
end
@ -373,7 +373,7 @@ describe WikiController, type: :controller do
describe '- wiki_menu_item containing special chars only' do
before do
@wiki_menu_item = FactoryGirl.create(:wiki_menu_item, navigatable_id: @project.wiki.id,
@wiki_menu_item = FactoryBot.create(:wiki_menu_item, navigatable_id: @project.wiki.id,
title: '?',
name: 'help')
@other_wiki_menu_item = @other_menu_item
@ -510,7 +510,7 @@ describe WikiController, type: :controller do
end
describe 'preview' do
let(:project) { FactoryGirl.create(:project) }
let(:project) { FactoryBot.create(:project) }
let(:text) { 'Wiki content' }
it_behaves_like 'valid preview' do
@ -522,7 +522,7 @@ describe WikiController, type: :controller do
end
it_behaves_like 'authorizes object access' do
let(:wiki_page) { FactoryGirl.create(:wiki_page) }
let(:wiki_page) { FactoryBot.create(:wiki_page) }
let(:preview_params) {
{ project_id: wiki_page.wiki.project.id,
id: wiki_page.id,

@ -33,22 +33,22 @@ describe WikiMenuItemsController, type: :controller do
User.delete_all
Role.delete_all
@project = FactoryGirl.create(:project)
@project = FactoryBot.create(:project)
@project.reload # project contains wiki by default
@params = {}
@params[:project_id] = @project.id
page = FactoryGirl.create(:wiki_page, wiki: @project.wiki)
page = FactoryBot.create(:wiki_page, wiki: @project.wiki)
@params[:id] = page.title
end
describe 'w/ valid auth' do
it 'renders the edit action' do
admin_user = FactoryGirl.create(:admin)
admin_user = FactoryBot.create(:admin)
allow(User).to receive(:current).and_return admin_user
permission_role = FactoryGirl.create(:role, name: 'accessgranted', permissions: [:manage_wiki_menu])
member = FactoryGirl.create(:member, principal: admin_user, user: admin_user, project: @project, roles: [permission_role])
permission_role = FactoryBot.create(:role, name: 'accessgranted', permissions: [:manage_wiki_menu])
member = FactoryBot.create(:member, principal: admin_user, user: admin_user, project: @project, roles: [permission_role])
get 'edit', params: @params
@ -58,7 +58,7 @@ describe WikiMenuItemsController, type: :controller do
describe 'w/o valid auth' do
it 'be forbidden' do
allow(User).to receive(:current).and_return FactoryGirl.create(:user)
allow(User).to receive(:current).and_return FactoryBot.create(:user)
get 'edit', params: @params

@ -29,14 +29,14 @@
require 'spec_helper'
describe WikiMenuItemsController, type: :controller do
let(:current_user) { FactoryGirl.create(:admin) }
let(:current_user) { FactoryBot.create(:admin) }
# create project with wiki
let(:project) { FactoryGirl.create(:project).reload } # a wiki is created for project, but the object doesn't know of it (FIXME?)
let(:project) { FactoryBot.create(:project).reload } # a wiki is created for project, but the object doesn't know of it (FIXME?)
let(:wiki) { project.wiki }
let(:wiki_page) { FactoryGirl.create(:wiki_page, wiki: wiki) } # first wiki page without child pages
let!(:top_level_wiki_menu_item) { FactoryGirl.create(:wiki_menu_item, :with_menu_item_options, wiki: wiki, name: wiki_page.slug) }
let(:wiki_page) { FactoryBot.create(:wiki_page, wiki: wiki) } # first wiki page without child pages
let!(:top_level_wiki_menu_item) { FactoryBot.create(:wiki_menu_item, :with_menu_item_options, wiki: wiki, name: wiki_page.slug) }
before :each do
# log in user
@ -45,17 +45,17 @@ describe WikiMenuItemsController, type: :controller do
describe '#edit' do
# more wiki pages with menu items
let(:another_wiki_page) { FactoryGirl.create(:wiki_page, wiki: wiki) } # second wiki page with two child pages
let!(:another_wiki_page_top_level_wiki_menu_item) { FactoryGirl.create(:wiki_menu_item, wiki: wiki, name: another_wiki_page.slug) }
let(:another_wiki_page) { FactoryBot.create(:wiki_page, wiki: wiki) } # second wiki page with two child pages
let!(:another_wiki_page_top_level_wiki_menu_item) { FactoryBot.create(:wiki_menu_item, wiki: wiki, name: another_wiki_page.slug) }
# child pages of another_wiki_page
let(:child_page) { FactoryGirl.create(:wiki_page, parent: another_wiki_page, wiki: wiki) }
let!(:child_page_wiki_menu_item) { FactoryGirl.create(:wiki_menu_item, wiki: wiki, name: child_page.slug) }
let(:another_child_page) { FactoryGirl.create(:wiki_page, parent: another_wiki_page, wiki: wiki) }
let!(:another_child_page_wiki_menu_item) { FactoryGirl.create(:wiki_menu_item, wiki: wiki, name: another_child_page.slug, parent: top_level_wiki_menu_item) }
let(:child_page) { FactoryBot.create(:wiki_page, parent: another_wiki_page, wiki: wiki) }
let!(:child_page_wiki_menu_item) { FactoryBot.create(:wiki_menu_item, wiki: wiki, name: child_page.slug) }
let(:another_child_page) { FactoryBot.create(:wiki_page, parent: another_wiki_page, wiki: wiki) }
let!(:another_child_page_wiki_menu_item) { FactoryBot.create(:wiki_menu_item, wiki: wiki, name: another_child_page.slug, parent: top_level_wiki_menu_item) }
let(:grand_child_page) { FactoryGirl.create(:wiki_page, parent: child_page, wiki: wiki) }
let!(:grand_child_page_wiki_menu_item) { FactoryGirl.create(:wiki_menu_item, wiki: wiki, name: grand_child_page.slug) }
let(:grand_child_page) { FactoryBot.create(:wiki_page, parent: child_page, wiki: wiki) }
let!(:grand_child_page_wiki_menu_item) { FactoryBot.create(:wiki_menu_item, wiki: wiki, name: grand_child_page.slug) }
context 'when no parent wiki menu item has been configured yet' do
context 'and it is a child page' do
@ -94,10 +94,10 @@ describe WikiMenuItemsController, type: :controller do
end
shared_context 'when there is one more wiki page with a child page' do
let!(:child_page) { FactoryGirl.create(:wiki_page, parent: wiki_page, wiki: wiki) }
let!(:child_page) { FactoryBot.create(:wiki_page, parent: wiki_page, wiki: wiki) }
let!(:another_wiki_page) { FactoryGirl.create(:wiki_page, wiki: wiki) } # second wiki page with two child pages
let!(:another_child_page) { FactoryGirl.create(:wiki_page, parent: another_wiki_page, wiki: wiki) }
let!(:another_wiki_page) { FactoryBot.create(:wiki_page, wiki: wiki) } # second wiki page with two child pages
let!(:another_child_page) { FactoryBot.create(:wiki_page, parent: another_wiki_page, wiki: wiki) }
end
describe '#select_main_menu_item' do

@ -29,30 +29,30 @@
require 'spec_helper'
describe WorkPackages::AutoCompletesController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:project) { FactoryGirl.create(:project) }
let(:user) { FactoryBot.create(:user) }
let(:project) { FactoryBot.create(:project) }
let(:role) {
FactoryGirl.create(:role,
FactoryBot.create(:role,
permissions: [:view_work_packages])
}
let(:member) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project,
principal: user,
roles: [role])
}
let(:work_package_1) do
FactoryGirl.create(:work_package, subject: "Can't print recipes",
FactoryBot.create(:work_package, subject: "Can't print recipes",
project: project)
end
let(:work_package_2) do
FactoryGirl.create(:work_package, subject: 'Error when updating a recipe',
FactoryBot.create(:work_package, subject: 'Error when updating a recipe',
project: project)
end
let(:work_package_3) do
FactoryGirl.create(:work_package, subject: 'Lorem ipsum',
FactoryBot.create(:work_package, subject: 'Lorem ipsum',
project: project)
end
@ -166,7 +166,7 @@ describe WorkPackages::AutoCompletesController, type: :controller do
describe 'returns work package for given id' do
render_views
let(:work_package_4) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
subject: "<script>alert('danger!');</script>",
project: project)
}
@ -191,17 +191,17 @@ describe WorkPackages::AutoCompletesController, type: :controller do
describe 'in different projects' do
let(:project_2) {
FactoryGirl.create(:project,
FactoryBot.create(:project,
parent: project)
}
let(:member_2) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project_2,
principal: user,
roles: [role])
}
let(:work_package_4) do
FactoryGirl.create(:work_package, subject: 'Foo Bar Baz',
FactoryBot.create(:work_package, subject: 'Foo Bar Baz',
project: project_2)
end

@ -29,56 +29,56 @@
require 'spec_helper'
describe WorkPackages::BulkController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:user2) { FactoryGirl.create(:user) }
let(:user) { FactoryBot.create(:user) }
let(:user2) { FactoryBot.create(:user) }
let(:custom_field_value) { '125' }
let(:custom_field_1) {
FactoryGirl.create(:work_package_custom_field,
FactoryBot.create(:work_package_custom_field,
field_format: 'string',
is_for_all: true)
}
let(:custom_field_2) { FactoryGirl.create(:work_package_custom_field) }
let(:custom_field_user) { FactoryGirl.create(:user_issue_custom_field) }
let(:status) { FactoryGirl.create(:status) }
let(:custom_field_2) { FactoryBot.create(:work_package_custom_field) }
let(:custom_field_user) { FactoryBot.create(:user_issue_custom_field) }
let(:status) { FactoryBot.create(:status) }
let(:type) {
FactoryGirl.create(:type_standard,
FactoryBot.create(:type_standard,
custom_fields: [custom_field_1, custom_field_2, custom_field_user])
}
let(:project_1) {
FactoryGirl.create(:project,
FactoryBot.create(:project,
types: [type],
work_package_custom_fields: [custom_field_2])
}
let(:project_2) {
FactoryGirl.create(:project,
FactoryBot.create(:project,
types: [type])
}
let(:role) {
FactoryGirl.create(:role,
FactoryBot.create(:role,
permissions: [:edit_work_packages,
:view_work_packages,
:manage_subtasks])
}
let(:member1_p1) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project_1,
principal: user,
roles: [role])
}
let(:member2_p1) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project_1,
principal: user2,
roles: [role])
}
let(:member1_p2) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project_2,
principal: user,
roles: [role])
}
let(:work_package_1) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
author: user,
assigned_to: user,
responsible: user2,
@ -88,7 +88,7 @@ describe WorkPackages::BulkController, type: :controller do
project: project_1)
}
let(:work_package_2) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
author: user,
assigned_to: user,
responsible: user2,
@ -98,7 +98,7 @@ describe WorkPackages::BulkController, type: :controller do
project: project_1)
}
let(:work_package_3) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
author: user,
type: type,
status: status,
@ -106,7 +106,7 @@ describe WorkPackages::BulkController, type: :controller do
project: project_2)
}
let(:stub_work_package) { FactoryGirl.build_stubbed(:work_package) }
let(:stub_work_package) { FactoryBot.build_stubbed(:work_package) }
before do
custom_field_1
@ -189,7 +189,7 @@ describe WorkPackages::BulkController, type: :controller do
describe '#update' do
let(:work_package_ids) { [work_package_1.id, work_package_2.id] }
let(:work_packages) { WorkPackage.where(id: work_package_ids) }
let(:priority) { FactoryGirl.create(:priority_immediate) }
let(:priority) { FactoryBot.create(:priority_immediate) }
let(:group_id) { '' }
let(:responsible_id) { '' }
@ -222,17 +222,17 @@ describe WorkPackages::BulkController, type: :controller do
context 'when updating two work packages with differing whitelisted params' do
let!(:work_package_ids) { [work_package_1.id, work_package_3.id] }
let!(:role_with_permission_to_add_watchers) { FactoryGirl.create(:role, permissions: role.permissions + [:add_work_package_watchers]) }
let!(:other_user) { FactoryGirl.create :user }
let!(:role_with_permission_to_add_watchers) { FactoryBot.create(:role, permissions: role.permissions + [:add_work_package_watchers]) }
let!(:other_user) { FactoryBot.create :user }
let!(:other_member_1) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project_1,
principal: other_user,
roles: [role_with_permission_to_add_watchers])
}
let!(:other_member_2) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project_2,
principal: other_user,
roles: [role])
@ -376,7 +376,7 @@ describe WorkPackages::BulkController, type: :controller do
describe '#properties' do
describe '#groups' do
let(:group) { FactoryGirl.create(:group) }
let(:group) { FactoryBot.create(:group) }
let(:group_id) { group.id }
include_context 'update_request'
@ -397,9 +397,9 @@ describe WorkPackages::BulkController, type: :controller do
end
describe '#status' do
let(:closed_status) { FactoryGirl.create(:closed_status) }
let(:closed_status) { FactoryBot.create(:closed_status) }
let(:workflow) {
FactoryGirl.create(:workflow,
FactoryBot.create(:workflow,
role: role,
type_id: type.id,
old_status: status,
@ -423,7 +423,7 @@ describe WorkPackages::BulkController, type: :controller do
describe '#parent' do
let(:parent) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
author: user,
project: project_1)
}
@ -493,13 +493,13 @@ describe WorkPackages::BulkController, type: :controller do
describe '#version' do
describe 'set fixed_version_id attribute to some version' do
let(:version) {
FactoryGirl.create(:version,
FactoryBot.create(:version,
status: 'open',
sharing: 'tree',
project: subproject)
}
let(:subproject) {
FactoryGirl.create(:project,
FactoryBot.create(:project,
parent: project_1,
types: [type])
}

@ -29,18 +29,18 @@
require 'spec_helper'
describe WorkPackages::CalendarsController, type: :controller do
let(:project) { FactoryGirl.create(:project) }
let(:project) { FactoryBot.create(:project) }
let(:role) {
FactoryGirl.create(:role,
FactoryBot.create(:role,
permissions: [:view_calendar])
}
let(:user) {
FactoryGirl.create(:user,
FactoryBot.create(:user,
member_in_project: project,
member_through_role: role)
}
let(:work_package) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
project: project)
}
@ -81,7 +81,7 @@ describe WorkPackages::CalendarsController, type: :controller do
context 'custom query' do
let (:query) {
FactoryGirl.create(:query,
FactoryBot.create(:query,
project: nil,
user: user)
}

@ -29,35 +29,35 @@
require 'spec_helper'
describe WorkPackages::MovesController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:user) { FactoryBot.create(:user) }
let(:role) do
FactoryGirl.create :role,
FactoryBot.create :role,
permissions: %i(move_work_packages
view_work_packages
add_work_packages
edit_work_packages
manage_subtasks)
end
let(:type) { FactoryGirl.create :type }
let(:type_2) { FactoryGirl.create :type }
let(:status) { FactoryGirl.create :default_status }
let(:target_status) { FactoryGirl.create :status }
let(:priority) { FactoryGirl.create :priority }
let(:target_priority) { FactoryGirl.create :priority }
let(:type) { FactoryBot.create :type }
let(:type_2) { FactoryBot.create :type }
let(:status) { FactoryBot.create :default_status }
let(:target_status) { FactoryBot.create :status }
let(:priority) { FactoryBot.create :priority }
let(:target_priority) { FactoryBot.create :priority }
let(:project) do
FactoryGirl.create(:project,
FactoryBot.create(:project,
is_public: false,
types: [type, type_2])
end
let(:work_package) do
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
project_id: project.id,
type: type,
author: user,
priority: priority)
end
let(:current_user) { FactoryGirl.create(:user) }
let(:current_user) { FactoryBot.create(:user) }
before do
allow(User).to receive(:current).and_return current_user
@ -116,11 +116,11 @@ describe WorkPackages::MovesController, type: :controller do
end
describe '#create' do
let!(:source_member) { FactoryGirl.create(:member, user: current_user, project: project, roles: [role]) }
let!(:target_member) { FactoryGirl.create(:member, user: current_user, project: target_project, roles: [role]) }
let(:target_project) { FactoryGirl.create(:project, is_public: false) }
let!(:source_member) { FactoryBot.create(:member, user: current_user, project: project, roles: [role]) }
let!(:target_member) { FactoryBot.create(:member, user: current_user, project: target_project, roles: [role]) }
let(:target_project) { FactoryBot.create(:project, is_public: false) }
let(:work_package_2) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
project_id: project.id,
type: type_2,
priority: priority)
@ -329,9 +329,9 @@ describe WorkPackages::MovesController, type: :controller do
let(:start_date) { Date.today }
let(:due_date) { Date.today + 1 }
let(:target_user) do
user = FactoryGirl.create :user
user = FactoryBot.create :user
FactoryGirl.create(:member,
FactoryBot.create(:member,
user: user,
project: target_project,
roles: [role])
@ -418,17 +418,17 @@ describe WorkPackages::MovesController, type: :controller do
context 'child work package from one project to other' do
let(:to_project) do
FactoryGirl.create(:project,
FactoryBot.create(:project,
types: [type])
end
let!(:member) do
FactoryGirl.create(:member,
FactoryBot.create(:member,
user: current_user,
roles: [role],
project: to_project)
end
let!(:child_wp) do
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
type: type,
project: project,
parent: work_package)

@ -29,32 +29,32 @@
require 'spec_helper'
describe WorkPackages::ReportsController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:project) { FactoryGirl.create(:project) }
let(:user) { FactoryBot.create(:user) }
let(:project) { FactoryBot.create(:project) }
let(:role) {
FactoryGirl.create(:role,
FactoryBot.create(:role,
permissions: [:view_work_packages])
}
let(:member) {
FactoryGirl.create(:member,
FactoryBot.create(:member,
project: project,
principal: user,
roles: [role])
}
let(:work_package_1) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
id: 21,
subject: "Can't print recipes",
project: project)
}
let(:work_package_2) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
id: 2101,
subject: 'Error 281 when updating a recipe',
project: project)
}
let(:work_package_3) {
FactoryGirl.create(:work_package,
FactoryBot.create(:work_package,
id: 2102,
project: project)
}

@ -38,11 +38,11 @@ describe WorkPackagesController, type: :controller do
allow(UserMailer).to receive(:new).and_return(double('mailer').as_null_object)
end
let(:project) { FactoryGirl.create(:project, identifier: 'test_project', is_public: false) }
let(:stub_project) { FactoryGirl.build_stubbed(:project, identifier: 'test_project', is_public: false) }
let(:project) { FactoryBot.create(:project, identifier: 'test_project', is_public: false) }
let(:stub_project) { FactoryBot.build_stubbed(:project, identifier: 'test_project', is_public: false) }
let(:stub_work_package) { double('work_package', id: 1337, project: stub_project).as_null_object }
let(:current_user) { FactoryGirl.create(:user) }
let(:current_user) { FactoryBot.create(:user) }
def self.requires_permission_in_project(&block)
describe 'w/o the permission to see the project/work_package' do
@ -118,7 +118,7 @@ describe WorkPackagesController, type: :controller do
end
describe 'index' do
let(:query) { FactoryGirl.build_stubbed(:query).tap(&:add_default_filter) }
let(:query) { FactoryBot.build_stubbed(:query).tap(&:add_default_filter) }
let(:work_packages) { double('work packages').as_null_object }
let(:results) { double('results').as_null_object }
@ -320,14 +320,14 @@ describe WorkPackagesController, type: :controller do
# ISO-8859-1. Since this can happen, though, it is more sensible to encode everything
# in UTF-8 which gets rid of this problem altogether.
let(:work_package) do
FactoryGirl.create(
FactoryBot.create(
:work_package,
subject: "Ruby encodes ß as '\\xDF' in ISO-8859-1.",
description: "\u2022 requires unicode.",
assigned_to: current_user
)
end
let(:current_user) { FactoryGirl.create(:admin) }
let(:current_user) { FactoryBot.create(:admin) }
it 'performs a successful export' do
wp = work_package.reload

@ -29,9 +29,9 @@
require 'spec_helper'
describe ::API::Decorators::Single do
let(:user) { FactoryGirl.build(:user, member_in_project: project, member_through_role: role) }
let(:project) { FactoryGirl.create(:project_with_types) }
let(:role) { FactoryGirl.create(:role, permissions: permissions) }
let(:user) { FactoryBot.build(:user, member_in_project: project, member_through_role: role) }
let(:project) { FactoryBot.create(:project_with_types) }
let(:role) { FactoryBot.create(:role, permissions: permissions) }
let(:permissions) { [:view_work_packages] }
let(:model) { Object.new }

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :announcement do
text 'Announcement text'
show_until Date.today + 14.days

@ -28,7 +28,7 @@
require Rails.root + 'spec/support/file_helpers'
FactoryGirl.define do
FactoryBot.define do
factory :attachment do
container factory: :work_package
author factory: :user

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :work_package_help_text, class: AttributeHelpText::WorkPackage do
type 'AttributeHelpText::WorkPackage'
help_text 'Attribute help text'

@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :auth_source do
name 'Test AuthSource'
end

@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :board do
project
sequence(:name) do |n| "Board No. #{n}" end

@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :category do
sequence(:name) do |n| "Issue category #{n}" end
project

@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :changeset do
sequence(:revision) do |n| "#{n}" end
committed_on Time.now

@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :comment do
author factory: :user
sequence(:comments) do |n| "I am a comment No. #{n}" end

@ -26,7 +26,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :custom_action do
sequence(:name) { |n| "Custom action #{n} - name" }
sequence(:description) { |n| "Custom action #{n} - description" }

@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :custom_field do
name 'Custom Field'
regexp ''

@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :custom_option do
sequence(:value) { |n| "Custom Option #{n}" }
end

@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :custom_style
factory :custom_style_with_logo, class: CustomStyle do

@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :custom_value do
custom_field
value ''

@ -26,14 +26,14 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory(:design_color, class: DesignColor) do
hexcode { ('#%0.6x' % rand(0xFFFFFF)).upcase }
end
end
{ "primary-color" => "#3493B3" }.each do |name, code|
FactoryGirl.define do
FactoryBot.define do
factory(:"design_color_#{name}", parent: :design_color) do
variable name
hexcode code

@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :default_enumeration, class: Enumeration do
initialize_with do
Enumeration.where(type: 'Enumeration', is_default: true).first || Enumeration.new

@ -26,11 +26,11 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
##
# Yields fixture files.
factory :file, class: File do
# Skip the create callback to be able to use non-AR models. Otherwise FactoryGirl will
# Skip the create callback to be able to use non-AR models. Otherwise FactoryBot will
# try to call #save! on any created object.
skip_create

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save