Commit 8c101fc3 authored by Timothy Andrew's avatar Timothy Andrew

Backport EE assertions in protected branch related specs.

- Use assertions in the vein of `merge_access_levels.map(&:access_level)`
  instead of `merge_access_levels.first.access_level`
parent f898a47e
...@@ -103,7 +103,7 @@ feature 'Projected Branches', feature: true, js: true do ...@@ -103,7 +103,7 @@ feature 'Projected Branches', feature: true, js: true do
click_on "Protect" click_on "Protect"
expect(ProtectedBranch.count).to eq(1) expect(ProtectedBranch.count).to eq(1)
expect(ProtectedBranch.last.push_access_levels.first.access_level).to eq(access_type_id) expect(ProtectedBranch.last.push_access_levels.map(&:access_level)).to eq([access_type_id])
end end
it "allows updating protected branches so that #{access_type_name} can push to them" do it "allows updating protected branches so that #{access_type_name} can push to them" do
...@@ -119,7 +119,7 @@ feature 'Projected Branches', feature: true, js: true do ...@@ -119,7 +119,7 @@ feature 'Projected Branches', feature: true, js: true do
end end
wait_for_ajax wait_for_ajax
expect(ProtectedBranch.last.push_access_levels.first.access_level).to eq(access_type_id) expect(ProtectedBranch.last.push_access_levels.map(&:access_level)).to include(access_type_id)
end end
end end
...@@ -138,7 +138,7 @@ feature 'Projected Branches', feature: true, js: true do ...@@ -138,7 +138,7 @@ feature 'Projected Branches', feature: true, js: true do
click_on "Protect" click_on "Protect"
expect(ProtectedBranch.count).to eq(1) expect(ProtectedBranch.count).to eq(1)
expect(ProtectedBranch.last.merge_access_levels.first.access_level).to eq(access_type_id) expect(ProtectedBranch.last.merge_access_levels.map(&:access_level)).to eq([access_type_id])
end end
it "allows updating protected branches so that #{access_type_name} can merge to them" do it "allows updating protected branches so that #{access_type_name} can merge to them" do
...@@ -154,7 +154,7 @@ feature 'Projected Branches', feature: true, js: true do ...@@ -154,7 +154,7 @@ feature 'Projected Branches', feature: true, js: true do
end end
wait_for_ajax wait_for_ajax
expect(ProtectedBranch.last.merge_access_levels.first.access_level).to eq(access_type_id) expect(ProtectedBranch.last.merge_access_levels.map(&:access_level)).to include(access_type_id)
end end
end end
end end
......
...@@ -227,8 +227,8 @@ describe GitPushService, services: true do ...@@ -227,8 +227,8 @@ describe GitPushService, services: true do
expect(project.default_branch).to eq("master") expect(project.default_branch).to eq("master")
execute_service(project, user, @blankrev, 'newrev', 'refs/heads/master' ) execute_service(project, user, @blankrev, 'newrev', 'refs/heads/master' )
expect(project.protected_branches).not_to be_empty expect(project.protected_branches).not_to be_empty
expect(project.protected_branches.first.push_access_levels.first.access_level).to eq(Gitlab::Access::MASTER) expect(project.protected_branches.first.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
expect(project.protected_branches.first.merge_access_levels.first.access_level).to eq(Gitlab::Access::MASTER) expect(project.protected_branches.first.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
end end
it "when pushing a branch for the first time with default branch protection disabled" do it "when pushing a branch for the first time with default branch protection disabled" do
...@@ -249,8 +249,8 @@ describe GitPushService, services: true do ...@@ -249,8 +249,8 @@ describe GitPushService, services: true do
execute_service(project, user, @blankrev, 'newrev', 'refs/heads/master' ) execute_service(project, user, @blankrev, 'newrev', 'refs/heads/master' )
expect(project.protected_branches).not_to be_empty expect(project.protected_branches).not_to be_empty
expect(project.protected_branches.last.push_access_levels.first.access_level).to eq(Gitlab::Access::DEVELOPER) expect(project.protected_branches.last.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::DEVELOPER])
expect(project.protected_branches.last.merge_access_levels.first.access_level).to eq(Gitlab::Access::MASTER) expect(project.protected_branches.last.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
end end
it "when pushing a branch for the first time with default branch protection set to 'developers can merge'" do it "when pushing a branch for the first time with default branch protection set to 'developers can merge'" do
...@@ -260,8 +260,8 @@ describe GitPushService, services: true do ...@@ -260,8 +260,8 @@ describe GitPushService, services: true do
expect(project.default_branch).to eq("master") expect(project.default_branch).to eq("master")
execute_service(project, user, @blankrev, 'newrev', 'refs/heads/master' ) execute_service(project, user, @blankrev, 'newrev', 'refs/heads/master' )
expect(project.protected_branches).not_to be_empty expect(project.protected_branches).not_to be_empty
expect(project.protected_branches.first.push_access_levels.first.access_level).to eq(Gitlab::Access::MASTER) expect(project.protected_branches.first.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
expect(project.protected_branches.first.merge_access_levels.first.access_level).to eq(Gitlab::Access::DEVELOPER) expect(project.protected_branches.first.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::DEVELOPER])
end end
it "when pushing new commits to existing branch" do it "when pushing new commits to existing branch" 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