2016-12-06 11:31:58 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ProjectAuthorization do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project1) { create(:empty_project) }
|
|
|
|
let(:project2) { create(:empty_project) }
|
|
|
|
|
|
|
|
describe '.insert_authorizations' do
|
|
|
|
it 'inserts the authorizations' do
|
2017-06-21 09:48:12 -04:00
|
|
|
described_class
|
|
|
|
.insert_authorizations([[user.id, project1.id, Gitlab::Access::MASTER]])
|
2016-12-06 11:31:58 -05:00
|
|
|
|
|
|
|
expect(user.project_authorizations.count).to eq(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'inserts rows in batches' do
|
|
|
|
described_class.insert_authorizations([
|
|
|
|
[user.id, project1.id, Gitlab::Access::MASTER],
|
2017-05-03 07:22:03 -04:00
|
|
|
[user.id, project2.id, Gitlab::Access::MASTER]
|
2016-12-06 11:31:58 -05:00
|
|
|
], 1)
|
|
|
|
|
|
|
|
expect(user.project_authorizations.count).to eq(2)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|