summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-03-27 14:43:48 +0100
committerDouwe Maan <douwe@gitlab.com>2015-04-03 12:23:20 +0200
commitedc4a56d26792b5b5bac21f45948412675ad7ebb (patch)
tree5691320e58507e134a2f026f8f4e8054821edf50 /spec
parent9157985cfce1391973673ea278dc7506a90f8f53 (diff)
downloadgitlab-ce-edc4a56d26792b5b5bac21f45948412675ad7ebb.tar.gz
Allow admin to create public deploy keys that are accessible to any project.
Diffstat (limited to 'spec')
-rw-r--r--spec/models/deploy_keys_project_spec.rb27
1 files changed, 21 insertions, 6 deletions
diff --git a/spec/models/deploy_keys_project_spec.rb b/spec/models/deploy_keys_project_spec.rb
index f351aab9238..7032b777144 100644
--- a/spec/models/deploy_keys_project_spec.rb
+++ b/spec/models/deploy_keys_project_spec.rb
@@ -28,17 +28,32 @@ describe DeployKeysProject do
let(:deploy_key) { subject.deploy_key }
context "when the deploy key is only used by this project" do
- it "destroys the deploy key" do
- subject.destroy
+ context "when the deploy key is public" do
+ before do
+ deploy_key.update_attribute(:public, true)
+ end
- expect {
- deploy_key.reload
- }.to raise_error(ActiveRecord::RecordNotFound)
+ it "doesn't destroy the deploy key" do
+ subject.destroy
+
+ expect {
+ deploy_key.reload
+ }.not_to raise_error(ActiveRecord::RecordNotFound)
+ end
+ end
+
+ context "when the deploy key is private" do
+ it "destroys the deploy key" do
+ subject.destroy
+
+ expect {
+ deploy_key.reload
+ }.to raise_error(ActiveRecord::RecordNotFound)
+ end
end
end
context "when the deploy key is used by more than one project" do
-
let!(:other_project) { create(:project) }
before do