FactoryGirl => FactoryBot (opf/openproject#6304)

pull/6827/head
Oliver Günther 7 years ago
parent d549c414b0
commit c16d635eb5
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 10
      spec/controllers/synchronized_groups_controller_spec.rb
  2. 2
      spec/factories/synchronized_group_factory.rb
  3. 6
      spec/features/administration_spec.rb
  4. 18
      spec/lib/synchronization_spec.rb
  5. 2
      spec/models/synchronized_group_spec.rb

@ -1,8 +1,8 @@
require_relative '../spec_helper'
describe ::LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groups], type: :controller do
let(:user) { FactoryGirl.create :user }
let(:admin) { FactoryGirl.create :admin }
let(:user) { FactoryBot.create :user }
let(:admin) { FactoryBot.create :admin }
before do
allow(User).to receive(:current).and_return(logged_in_user)
@ -55,7 +55,7 @@ describe ::LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groups], t
end
context 'when entry exists' do
let!(:group) { FactoryGirl.build_stubbed :ldap_synchronized_group }
let!(:group) { FactoryBot.build_stubbed :ldap_synchronized_group }
let(:id) { 'foo' }
it 'renders the page' do
@ -165,7 +165,7 @@ describe ::LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groups], t
end
context 'when entry exists' do
let!(:group) { FactoryGirl.build_stubbed :ldap_synchronized_group }
let!(:group) { FactoryBot.build_stubbed :ldap_synchronized_group }
let(:id) { 'foo' }
it 'renders the page' do
@ -206,7 +206,7 @@ describe ::LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groups], t
end
context 'when entry exists' do
let!(:group) { FactoryGirl.build_stubbed :ldap_synchronized_group }
let!(:group) { FactoryBot.build_stubbed :ldap_synchronized_group }
let(:id) { 'foo' }
before do

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :ldap_synchronized_group, class: ::LdapGroups::SynchronizedGroup do
entry 'uid'
group factory: :group

@ -1,7 +1,7 @@
require_relative '../spec_helper'
describe 'LDAP group sync administration spec', type: :feature, js: true do
let(:admin) { FactoryGirl.create :admin }
let(:admin) { FactoryBot.create :admin }
before do
login_as admin
@ -15,8 +15,8 @@ describe 'LDAP group sync administration spec', type: :feature, js: true do
end
context 'with EE', with_ee: %i[ldap_groups] do
let!(:group) { FactoryGirl.create :group, lastname: 'foo' }
let!(:auth_source) { FactoryGirl.create :ldap_auth_source, name: 'ldap' }
let!(:group) { FactoryBot.create :group, lastname: 'foo' }
let!(:auth_source) { FactoryBot.create :ldap_auth_source, name: 'ldap' }
it 'allows synced group administration flow' do
expect(page).to have_no_selector('.upsale-notification')

@ -24,7 +24,7 @@ describe OpenProject::LdapGroups::Synchronization, with_ee: %i[ldap_groups] do
# three users aa729, bb459, cc414
# two groups foo (aa729), bar(aa729, bb459, cc414)
let(:auth_source) do
FactoryGirl.create :ldap_auth_source,
FactoryBot.create :ldap_auth_source,
port: '12389',
account: 'uid=admin,ou=system',
account_password: 'secret',
@ -32,15 +32,15 @@ describe OpenProject::LdapGroups::Synchronization, with_ee: %i[ldap_groups] do
attr_login: 'uid'
end
let(:user_aa729) { FactoryGirl.create :user, login: 'aa729', auth_source: auth_source }
let(:user_bb459) { FactoryGirl.create :user, login: 'bb459', auth_source: auth_source }
let(:user_cc414) { FactoryGirl.create :user, login: 'cc414', auth_source: auth_source }
let(:user_aa729) { FactoryBot.create :user, login: 'aa729', auth_source: auth_source }
let(:user_bb459) { FactoryBot.create :user, login: 'bb459', auth_source: auth_source }
let(:user_cc414) { FactoryBot.create :user, login: 'cc414', auth_source: auth_source }
let(:group_foo) { FactoryGirl.create :group, lastname: 'foo_internal' }
let(:group_bar) { FactoryGirl.create :group, lastname: 'bar' }
let(:group_foo) { FactoryBot.create :group, lastname: 'foo_internal' }
let(:group_bar) { FactoryBot.create :group, lastname: 'bar' }
let(:synced_foo) { FactoryGirl.create :ldap_synchronized_group, entry: 'foo', group: group_foo, auth_source: auth_source }
let(:synced_bar) { FactoryGirl.create :ldap_synchronized_group, entry: 'bar', group: group_bar, auth_source: auth_source }
let(:synced_foo) { FactoryBot.create :ldap_synchronized_group, entry: 'foo', group: group_foo, auth_source: auth_source }
let(:synced_bar) { FactoryBot.create :ldap_synchronized_group, entry: 'bar', group: group_bar, auth_source: auth_source }
subject { described_class.new auth_source }
@ -205,7 +205,7 @@ describe OpenProject::LdapGroups::Synchronization, with_ee: %i[ldap_groups] do
end
context 'with invalid connection' do
let(:auth_source) { FactoryGirl.create :ldap_auth_source }
let(:auth_source) { FactoryBot.create :ldap_auth_source }
before do
synced_foo

@ -1,7 +1,7 @@
require 'spec_helper'
describe LdapGroups::SynchronizedGroup, type: :model do
subject { FactoryGirl.build :ldap_synchronized_group }
subject { FactoryBot.build :ldap_synchronized_group }
describe '#escaped_entry' do
it 'escapes the entry for ldap' do

Loading…
Cancel
Save