summaryrefslogtreecommitdiff
path: root/spec/gitlab_keys_spec.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2013-11-20 13:18:19 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2013-11-20 13:21:51 +0100
commit559196cb27bc524db81e21ac4d890fd695961d14 (patch)
tree5d5f3549b3c3ccb083c0bc59375438967086eeae /spec/gitlab_keys_spec.rb
parentc67395e924496016a2ccec6eb0e4c42612f6d545 (diff)
downloadgitlab-shell-559196cb27bc524db81e21ac4d890fd695961d14.tar.gz
Fix return values in GitlabKeys
Diffstat (limited to 'spec/gitlab_keys_spec.rb')
-rw-r--r--spec/gitlab_keys_spec.rb27
1 files changed, 23 insertions, 4 deletions
diff --git a/spec/gitlab_keys_spec.rb b/spec/gitlab_keys_spec.rb
index a0bf678..20768e2 100644
--- a/spec/gitlab_keys_spec.rb
+++ b/spec/gitlab_keys_spec.rb
@@ -25,10 +25,17 @@ describe GitlabKeys do
File.read(tmp_authorized_keys_path).should == "existing content\n#{auth_line}\n"
end
- it "should log an add-key event" do
- $logger.should_receive(:info).with('Adding key key-741 => "ssh-rsa AAAAB3NzaDAxx2E"')
- gitlab_keys.stub(:open)
- gitlab_keys.send :add_key
+ context "without file writing" do
+ before { gitlab_keys.stub(:open) }
+
+ it "should log an add-key event" do
+ $logger.should_receive(:info).with('Adding key key-741 => "ssh-rsa AAAAB3NzaDAxx2E"')
+ gitlab_keys.send :add_key
+ end
+
+ it "should return true" do
+ gitlab_keys.send(:add_key).should be_true
+ end
end
end
@@ -50,6 +57,18 @@ describe GitlabKeys do
$logger.should_receive(:info).with('Removing key key-741')
gitlab_keys.send :rm_key
end
+
+ it "should return true" do
+ gitlab_keys.send(:rm_key).should be_true
+ end
+ end
+
+ describe :clear do
+ let(:gitlab_keys) { build_gitlab_keys('clear') }
+
+ it "should return true" do
+ gitlab_keys.send(:clear).should be_true
+ end
end
describe :exec do