summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-05-04 12:14:57 -0500
committerDouwe Maan <douwe@selenight.nl>2017-05-04 12:14:57 -0500
commit4b1977466172a629f560475c5d9257c5b255f6c9 (patch)
treee6c1f8ef0493e576cc8bae6035a550c7643558cc
parent31f513a3b776e2a58a2c72a5414a77f6b7efc71e (diff)
downloadgitlab-ce-4b1977466172a629f560475c5d9257c5b255f6c9.tar.gz
Clean up some specs and remove space between word and comma
-rw-r--r--app/views/projects/branches/_delete_protected_modal.html.haml5
-rw-r--r--spec/lib/gitlab/git_access_spec.rb35
-rw-r--r--spec/services/delete_merged_branches_service_spec.rb26
3 files changed, 28 insertions, 38 deletions
diff --git a/app/views/projects/branches/_delete_protected_modal.html.haml b/app/views/projects/branches/_delete_protected_modal.html.haml
index f57c4611981..26664c5d80c 100644
--- a/app/views/projects/branches/_delete_protected_modal.html.haml
+++ b/app/views/projects/branches/_delete_protected_modal.html.haml
@@ -17,8 +17,9 @@
This branch hasn’t been merged yet. To avoid data loss, consider merging this branch into another before deleting it.
%p
Once you confirm and press
- %strong Delete protected branch
- , it cannot be undone or recovered.
+ = succeed ',' do
+ %strong Delete protected branch
+ it cannot be undone or recovered.
%p
%strong To confirm, type
%kbd.js-branch-name [branch name]
diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb
index 60a358cbc10..25769977f24 100644
--- a/spec/lib/gitlab/git_access_spec.rb
+++ b/spec/lib/gitlab/git_access_spec.rb
@@ -1,8 +1,7 @@
require 'spec_helper'
describe Gitlab::GitAccess, lib: true do
- let(:protocol) { 'web' }
- let(:access) { Gitlab::GitAccess.new(actor, project, protocol, authentication_abilities: authentication_abilities) }
+ let(:access) { Gitlab::GitAccess.new(actor, project, 'ssh', authentication_abilities: authentication_abilities) }
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:actor) { user }
@@ -226,7 +225,7 @@ describe Gitlab::GitAccess, lib: true do
# Run permission checks for a user
def self.run_permission_checks(permissions_matrix)
- permissions_matrix.each do |role, actions|
+ permissions_matrix.keys.each do |role|
describe "#{role} access" do
before do
if role == :admin
@@ -236,25 +235,15 @@ describe Gitlab::GitAccess, lib: true do
end
end
- actions.each do |action, allowed_by_protocol|
- unless allowed_by_protocol.is_a?(Hash)
- allowed_by_protocol = { 'web' => allowed_by_protocol }
- end
-
+ permissions_matrix[role].each do |action, allowed|
context action do
- allowed_by_protocol.each do |proto, allowed|
- context "over #{proto} protocol" do
- let(:protocol) { proto }
-
- subject { access.send(:check_push_access!, changes[action]) }
-
- it do
- if allowed
- expect { subject }.not_to raise_error
- else
- expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError)
- end
- end
+ subject { access.send(:check_push_access!, changes[action]) }
+
+ it do
+ if allowed
+ expect { subject }.not_to raise_error
+ else
+ expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError)
end
end
end
@@ -268,7 +257,7 @@ describe Gitlab::GitAccess, lib: true do
push_new_branch: true,
push_master: true,
push_protected_branch: true,
- push_remove_protected_branch: { 'web' => true, 'ssh' => false },
+ push_remove_protected_branch: false,
push_tag: true,
push_new_tag: true,
push_all: true,
@@ -279,7 +268,7 @@ describe Gitlab::GitAccess, lib: true do
push_new_branch: true,
push_master: true,
push_protected_branch: true,
- push_remove_protected_branch: { 'web' => true, 'ssh' => false },
+ push_remove_protected_branch: false,
push_tag: true,
push_new_tag: true,
push_all: true,
diff --git a/spec/services/delete_merged_branches_service_spec.rb b/spec/services/delete_merged_branches_service_spec.rb
index 81372b2bf4b..cae74df9c90 100644
--- a/spec/services/delete_merged_branches_service_spec.rb
+++ b/spec/services/delete_merged_branches_service_spec.rb
@@ -6,22 +6,22 @@ describe DeleteMergedBranchesService, services: true do
let(:project) { create(:project, :repository) }
context '#execute' do
- context 'regular branches' do
- before do
- service.execute
- end
+ it 'deletes a branch that was merged' do
+ service.execute
- it 'deletes a branch that was merged' do
- expect(project.repository.branch_names).not_to include('improve/awesome')
- end
+ expect(project.repository.branch_names).not_to include('improve/awesome')
+ end
- it 'keeps branch that is unmerged' do
- expect(project.repository.branch_names).to include('feature')
- end
+ it 'keeps branch that is unmerged' do
+ service.execute
- it 'keeps "master"' do
- expect(project.repository.branch_names).to include('master')
- end
+ expect(project.repository.branch_names).to include('feature')
+ end
+
+ it 'keeps "master"' do
+ service.execute
+
+ expect(project.repository.branch_names).to include('master')
end
context 'user without rights' do