Skip to content

Commit

Permalink
Merge pull request #1 from opf/housekeeping/bump-factory-girl
Browse files Browse the repository at this point in the history
FactoryGirl => FactoryBot (opf/openproject#6304)
  • Loading branch information
ulferts committed May 8, 2018
2 parents d0b0ad1 + c16d635 commit 2ba7a30
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions spec/controllers/synchronized_groups_controller_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)
Expand Down Expand Up @@ -55,7 +55,7 @@
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
Expand Down Expand Up @@ -165,7 +165,7 @@
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
Expand Down Expand Up @@ -206,7 +206,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/synchronized_group_factory.rb
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :ldap_synchronized_group, class: ::LdapGroups::SynchronizedGroup do
entry 'uid'
group factory: :group
Expand Down
6 changes: 3 additions & 3 deletions spec/features/administration_spec.rb
@@ -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
Expand All @@ -15,8 +15,8 @@
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')
Expand Down
18 changes: 9 additions & 9 deletions spec/lib/synchronization_spec.rb
Expand Up @@ -24,23 +24,23 @@
# 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',
base_dn: 'ou=people,dc=example,dc=com',
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 }

Expand Down Expand Up @@ -205,7 +205,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion spec/models/synchronized_group_spec.rb
@@ -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
Expand Down

0 comments on commit 2ba7a30

Please sign in to comment.