FactoryGirl => FactoryBot (opf/openproject#6304)

pull/6827/head
Oliver Günther 7 years ago
parent 2959334925
commit ab2117d3d8
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 4
      spec/controllers/my_projects_overview_controller_spec.rb
  2. 2
      spec/factories/my_projects_overview_factory.rb
  3. 12
      spec/features/block_editing_spec.rb
  4. 10
      spec/features/project_overview_spec.rb
  5. 2
      spec/models/my_projects_overview_spec.rb

@ -21,8 +21,8 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe MyProjectsOverviewsController, type: :controller do
let(:admin) { FactoryGirl.build_stubbed(:admin) }
let(:project) { FactoryGirl.build_stubbed(:project) }
let(:admin) { FactoryBot.build_stubbed(:admin) }
let(:project) { FactoryBot.build_stubbed(:project) }
let(:overview) { double(MyProjectsOverview) }
let(:custom_block) { %w(a title content) }

@ -26,7 +26,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
FactoryBot.define do
factory :my_projects_overview do
project
end

@ -29,16 +29,16 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe 'My project page editing', type: :feature, js: true do
let(:project) { FactoryGirl.create :project }
let(:overview) { FactoryGirl.create :my_projects_overview, project: project }
let(:project) { FactoryBot.create :project }
let(:overview) { FactoryBot.create :my_projects_overview, project: project }
let(:mypage) { ::Pages::Page.new }
let(:button_selector) { '.toolbar a.button' }
let(:user) { FactoryGirl.create :user,
let(:user) { FactoryBot.create :user,
member_in_project: project,
member_through_role: role }
let(:role) { FactoryGirl.create :role, permissions: [:view_project,
let(:role) { FactoryBot.create :role, permissions: [:view_project,
:edit_project] }
# Add block select
@ -195,8 +195,8 @@ describe 'My project page editing', type: :feature, js: true do
context 'as regular user' do
let(:permissions) { %i(view_project) }
let(:role) { FactoryGirl.create :role, permissions: permissions }
let(:user) { FactoryGirl.create(:user, member_in_project: project, member_through_role: role) }
let(:role) { FactoryBot.create :role, permissions: permissions }
let(:user) { FactoryBot.create(:user, member_in_project: project, member_through_role: role) }
it 'shows a 403 error' do
expect(page).to have_selector('h2', text: '403')

@ -29,8 +29,8 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe 'My project page overview', type: :feature do
let(:project) { FactoryGirl.create :project }
let(:overview) { FactoryGirl.create :my_projects_overview, project: project }
let(:project) { FactoryBot.create :project }
let(:overview) { FactoryBot.create :my_projects_overview, project: project }
let(:button_selector) { '#my-project-page-layout' }
@ -43,7 +43,7 @@ describe 'My project page overview', type: :feature do
end
context 'as admin' do
let(:user) { FactoryGirl.create :admin }
let(:user) { FactoryBot.create :admin }
it 'shows the default blocks and edit button' do
expect(page).to have_selector('.widget-box', count: 5)
@ -53,8 +53,8 @@ describe 'My project page overview', type: :feature do
context 'as regular user' do
let(:permissions) { %i(view_project) }
let(:role) { FactoryGirl.create :role, permissions: permissions }
let(:user) { FactoryGirl.create(:user, member_in_project: project, member_through_role: role) }
let(:role) { FactoryBot.create :role, permissions: permissions }
let(:user) { FactoryBot.create(:user, member_in_project: project, member_through_role: role) }
it 'shows the default blocks, but no editing' do
expect(page).to have_selector('.widget-box', count: 5)

@ -22,7 +22,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe MyProjectsOverview, type: :model do
let(:enabled_modules) { %w[activity work_package_tracking news wiki] }
let(:project) { FactoryGirl.create(:project, enabled_module_names: @enabled_module_names) }
let(:project) { FactoryBot.create(:project, enabled_module_names: @enabled_module_names) }
subject { MyProjectsOverview.new(project_id: project.id) }

Loading…
Cancel
Save