debian-mirror-gitlab/spec/models/project_authorization_spec.rb

26 lines
705 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'spec_helper'
describe ProjectAuthorization do
let(:user) { create(:user) }
2017-09-10 17:25:29 +05:30
let(:project1) { create(:project) }
let(:project2) { create(:project) }
2017-08-17 22:00:37 +05:30
describe '.insert_authorizations' do
it 'inserts the authorizations' do
2017-09-10 17:25:29 +05:30
described_class
2018-11-18 11:00:15 +05:30
.insert_authorizations([[user.id, project1.id, Gitlab::Access::MAINTAINER]])
2017-08-17 22:00:37 +05:30
expect(user.project_authorizations.count).to eq(1)
end
it 'inserts rows in batches' do
described_class.insert_authorizations([
2018-11-18 11:00:15 +05:30
[user.id, project1.id, Gitlab::Access::MAINTAINER],
[user.id, project2.id, Gitlab::Access::MAINTAINER]
2017-08-17 22:00:37 +05:30
], 1)
expect(user.project_authorizations.count).to eq(2)
end
end
end