Read about our upcoming Code of Conduct on this issue

Commit e22d200a authored by Mark Chao's avatar Mark Chao Committed by Dmitriy Zaporozhets
Browse files

Resolve "Rename the `Master` role to `Maintainer`" Backend

parent 2649cbe0cb26
......@@ -30,10 +30,10 @@
it 'updates the authorized projects of the user' do
project2 = create(:project)
to_remove = user.project_authorizations
.create!(project: project2, access_level: Gitlab::Access::MASTER)
.create!(project: project2, access_level: Gitlab::Access::MAINTAINER)
expect(service).to receive(:update_authorizations)
.with([to_remove.project_id], [[user.id, project.id, Gitlab::Access::MASTER]])
.with([to_remove.project_id], [[user.id, project.id, Gitlab::Access::MAINTAINER]])
service.execute_without_lease
end
......@@ -45,7 +45,7 @@
.create!(project: project, access_level: Gitlab::Access::DEVELOPER)
expect(service).to receive(:update_authorizations)
.with([to_remove.project_id], [[user.id, project.id, Gitlab::Access::MASTER]])
.with([to_remove.project_id], [[user.id, project.id, Gitlab::Access::MAINTAINER]])
service.execute_without_lease
end
......@@ -76,14 +76,14 @@
it 'inserts authorizations that should be added' do
user.project_authorizations.delete_all
service.update_authorizations([], [[user.id, project.id, Gitlab::Access::MASTER]])
service.update_authorizations([], [[user.id, project.id, Gitlab::Access::MAINTAINER]])
authorizations = user.project_authorizations
expect(authorizations.length).to eq(1)
expect(authorizations[0].user_id).to eq(user.id)
expect(authorizations[0].project_id).to eq(project.id)
expect(authorizations[0].access_level).to eq(Gitlab::Access::MASTER)
expect(authorizations[0].access_level).to eq(Gitlab::Access::MAINTAINER)
end
end
......@@ -99,12 +99,12 @@
end
it 'sets the values to the access levels' do
expect(hash.values).to eq([Gitlab::Access::MASTER])
expect(hash.values).to eq([Gitlab::Access::MAINTAINER])
end
context 'personal projects' do
it 'includes the project with the right access level' do
expect(hash[project.id]).to eq(Gitlab::Access::MASTER)
expect(hash[project.id]).to eq(Gitlab::Access::MAINTAINER)
end
end
......@@ -139,11 +139,11 @@
let!(:other_project) { create(:project, group: nested_group) }
before do
group.add_master(user)
group.add_maintainer(user)
end
it 'includes the project with the right access level' do
expect(hash[other_project.id]).to eq(Gitlab::Access::MASTER)
expect(hash[other_project.id]).to eq(Gitlab::Access::MAINTAINER)
end
end
......@@ -153,7 +153,7 @@
let!(:project_group_link) { create(:project_group_link, project: other_project, group: group, group_access: Gitlab::Access::GUEST) }
before do
group.add_master(user)
group.add_maintainer(user)
end
it 'includes the project with the right access level' do
......@@ -168,7 +168,7 @@
let!(:project_group_link) { create(:project_group_link, project: other_project, group: nested_group, group_access: Gitlab::Access::DEVELOPER) }
before do
group.add_master(user)
group.add_maintainer(user)
end
it 'includes the project with the right access level' do
......@@ -194,7 +194,7 @@
value = hash.values[0]
expect(value.project_id).to eq(project.id)
expect(value.access_level).to eq(Gitlab::Access::MASTER)
expect(value.access_level).to eq(Gitlab::Access::MAINTAINER)
end
end
......@@ -219,7 +219,7 @@
end
it 'includes the access level for every row' do
expect(row.access_level).to eq(Gitlab::Access::MASTER)
expect(row.access_level).to eq(Gitlab::Access::MAINTAINER)
end
end
end
......@@ -235,7 +235,7 @@
rows = service.fresh_authorizations.to_a
expect(rows.length).to eq(1)
expect(rows.first.access_level).to eq(Gitlab::Access::MASTER)
expect(rows.first.access_level).to eq(Gitlab::Access::MAINTAINER)
end
context 'every returned row' do
......@@ -246,7 +246,7 @@
end
it 'includes the access level' do
expect(row.access_level).to eq(Gitlab::Access::MASTER)
expect(row.access_level).to eq(Gitlab::Access::MAINTAINER)
end
end
end
......
......@@ -4,7 +4,7 @@
shared_examples 'issuable record that supports quick actions in its description and notes' do |issuable_type|
include Spec::Support::Helpers::Features::NotesHelpers
let(:master) { create(:user) }
let(:maintainer) { create(:user) }
let(:project) do
case issuable_type
when :merge_request
......@@ -19,9 +19,9 @@
let(:new_url_opts) { {} }
before do
project.add_master(master)
project.add_maintainer(maintainer)
gitlab_sign_in(master)
gitlab_sign_in(maintainer)
end
after do
......@@ -210,31 +210,31 @@
expect(page).not_to have_content '/todo'
expect(page).to have_content 'Commands applied'
todos = TodosFinder.new(master).execute
todos = TodosFinder.new(maintainer).execute
todo = todos.first
expect(todos.size).to eq 1
expect(todo).to be_pending
expect(todo.target).to eq issuable
expect(todo.author).to eq master
expect(todo.user).to eq master
expect(todo.author).to eq maintainer
expect(todo.user).to eq maintainer
end
end
context "with a note marking the #{issuable_type} as done" do
before do
TodoService.new.mark_todo(issuable, master)
TodoService.new.mark_todo(issuable, maintainer)
end
it "creates a new todo for the #{issuable_type}" do
todos = TodosFinder.new(master).execute
todos = TodosFinder.new(maintainer).execute
todo = todos.first
expect(todos.size).to eq 1
expect(todos.first).to be_pending
expect(todo.target).to eq issuable
expect(todo.author).to eq master
expect(todo.user).to eq master
expect(todo.author).to eq maintainer
expect(todo.user).to eq maintainer
add_note("/done")
......@@ -247,31 +247,31 @@
context "with a note subscribing to the #{issuable_type}" do
it "creates a new todo for the #{issuable_type}" do
expect(issuable.subscribed?(master, project)).to be_falsy
expect(issuable.subscribed?(maintainer, project)).to be_falsy
add_note("/subscribe")
expect(page).not_to have_content '/subscribe'
expect(page).to have_content 'Commands applied'
expect(issuable.subscribed?(master, project)).to be_truthy
expect(issuable.subscribed?(maintainer, project)).to be_truthy
end
end
context "with a note unsubscribing to the #{issuable_type} as done" do
before do
issuable.subscribe(master, project)
issuable.subscribe(maintainer, project)
end
it "creates a new todo for the #{issuable_type}" do
expect(issuable.subscribed?(master, project)).to be_truthy
expect(issuable.subscribed?(maintainer, project)).to be_truthy
add_note("/unsubscribe")
expect(page).not_to have_content '/unsubscribe'
expect(page).to have_content 'Commands applied'
expect(issuable.subscribed?(master, project)).to be_falsy
expect(issuable.subscribed?(maintainer, project)).to be_falsy
end
end
......@@ -282,7 +282,7 @@
expect(page).not_to have_content '/assign me'
expect(page).to have_content 'Commands applied'
expect(issuable.reload.assignees).to eq [master]
expect(issuable.reload.assignees).to eq [maintainer]
end
end
end
......
......@@ -24,7 +24,7 @@ def group
def project
@project ||= create(:project, :repository, group: group).tap do |project|
project.add_master(user)
project.add_maintainer(user)
end
end
......
......@@ -37,7 +37,7 @@ def setup_project
event = create(:event, :created, target: milestone, project: project, author: user, action: 5)
create(:push_event_payload, event: event)
create(:project_member, :master, user: user, project: project)
create(:project_member, :maintainer, user: user, project: project)
create(:ci_variable, project: project)
create(:ci_trigger, project: project)
key = create(:deploy_key)
......
......@@ -24,7 +24,7 @@ def emulate_user(role, membership = nil)
when User
user = role
sign_in(user)
when *Gitlab::Access.sym_options_with_owner.keys # owner, master, developer, reporter, guest
when *Gitlab::Access.sym_options_with_owner.keys # owner, maintainer, developer, reporter, guest
raise ArgumentError, "cannot emulate #{role} without membership parent" unless membership
user = create_user_by_membership(role, membership)
......
......@@ -3,7 +3,7 @@
shared_examples 'new issuable record that supports quick actions' do
let!(:project) { create(:project, :repository) }
let(:user) { create(:user).tap { |u| project.add_master(u) } }
let(:user) { create(:user).tap { |u| project.add_maintainer(u) } }
let(:assignee) { create(:user) }
let!(:milestone) { create(:milestone, project: project) }
let!(:labels) { create_list(:label, 3, project: project) }
......@@ -12,7 +12,7 @@
let(:issuable) { described_class.new(project, user, params).execute }
before do
project.add_master(assignee)
project.add_maintainer(assignee)
end
context 'with labels in command only' do
......
......@@ -10,9 +10,9 @@
let!(:label2) { create(:label, project: target_project) }
before do
source_project.add_master(user)
target_project.add_master(user)
target_project.add_master(user2)
source_project.add_maintainer(user)
target_project.add_maintainer(user)
target_project.add_maintainer(user2)
sign_in(user)
visit project_new_merge_request_path(
......
......@@ -15,9 +15,9 @@
end
before do
source_project.add_master(user)
target_project.add_master(user)
target_project.add_master(user2)
source_project.add_maintainer(user)
target_project.add_maintainer(user)
target_project.add_maintainer(user2)
sign_in(user)
visit edit_project_merge_request_path(target_project, merge_request)
......
RSpec.shared_examples 'Master manages access requests' do
RSpec.shared_examples 'Maintainer manages access requests' do
let(:user) { create(:user) }
let(:master) { create(:user) }
let(:maintainer) { create(:user) }
before do
entity.request_access(user)
entity.respond_to?(:add_owner) ? entity.add_owner(master) : entity.add_master(master)
sign_in(master)
entity.respond_to?(:add_owner) ? entity.add_owner(maintainer) : entity.add_maintainer(maintainer)
sign_in(maintainer)
end
it 'master can see access requests' do
it 'maintainer can see access requests' do
visit members_page_path
expect_visible_access_request(entity, user)
end
it 'master can grant access', :js do
it 'maintainer can grant access', :js do
visit members_page_path
expect_visible_access_request(entity, user)
......@@ -28,7 +28,7 @@
end
end
it 'master can deny access', :js do
it 'maintainer can deny access', :js do
visit members_page_path
expect_visible_access_request(entity, user)
......
......@@ -21,7 +21,7 @@
it "calls NotificationService.update_#{entity_type}_member" do
expect(notification_service).to receive(:"update_#{entity_type}_member").with(member)
member.update_attribute(:access_level, Member::MASTER)
member.update_attribute(:access_level, Member::MAINTAINER)
end
it "does not send an email when the access level has not changed" do
......
......@@ -9,7 +9,7 @@
before do
project.import_state.update(last_error: '<a href="http://googl.com">Foo</a>')
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
it "escapes HTML in import errors" do
......
......@@ -2,7 +2,7 @@
describe 'projects/pipeline_schedules/_pipeline_schedule' do
let(:owner) { create(:user) }
let(:master) { create(:user) }
let(:maintainer) { create(:user) }
let(:project) { create(:project) }
let(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project) }
......@@ -17,10 +17,10 @@
context 'taking ownership of schedule' do
context 'when non-owner is signed in' do
let(:user) { master }
let(:user) { maintainer }
before do
allow(view).to receive(:can?).with(master, :take_ownership_pipeline_schedule, pipeline_schedule).and_return(true)
allow(view).to receive(:can?).with(maintainer, :take_ownership_pipeline_schedule, pipeline_schedule).and_return(true)
end
it 'non-owner can take ownership of pipeline' do
......
......@@ -7,7 +7,7 @@
let(:project) { create(:project, :repository) }
before do
project.add_master(user)
project.add_maintainer(user)
assign(:project, project)
assign(:note, note)
......
......@@ -8,7 +8,7 @@
let!(:author) { merge_request.author }
before do
source_project.add_master(author)
source_project.add_maintainer(author)
source_project.repository.expire_branches_cache
end
......
......@@ -18,7 +18,7 @@
context 'when the schedule is runnable by the user' do
before do
project.add_master(user)
project.add_maintainer(user)
end
context 'when there is a scheduled pipeline within next_run_at' do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment