summaryrefslogtreecommitdiff
path: root/spec/gitlab_keys_spec.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-05-30 11:44:38 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-05-30 11:44:38 +0200
commit2c5d04deb2e9252b346e5701da81f62f28f800db (patch)
treea6e5b2bb5afc29987ada73dcaf215559a82b1ea1 /spec/gitlab_keys_spec.rb
parentc26647b9d919085c669f49c71d0646ac23b9c9d9 (diff)
downloadgitlab-shell-2c5d04deb2e9252b346e5701da81f62f28f800db.tar.gz
Put authorized_keys.lock in the .ssh directory
Diffstat (limited to 'spec/gitlab_keys_spec.rb')
-rw-r--r--spec/gitlab_keys_spec.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/gitlab_keys_spec.rb b/spec/gitlab_keys_spec.rb
index 2ef7241..773b0b6 100644
--- a/spec/gitlab_keys_spec.rb
+++ b/spec/gitlab_keys_spec.rb
@@ -96,7 +96,10 @@ describe GitlabKeys do
end
context "without file writing" do
- before { Tempfile.stub(:open) }
+ before do
+ Tempfile.stub(:open)
+ gitlab_keys.stub(:lock).and_yield
+ end
it "should log an rm-key event" do
$logger.should_receive(:info).with('Removing key key-741')
@@ -146,6 +149,10 @@ describe GitlabKeys do
end
describe :lock do
+ before do
+ GitlabKeys.any_instance.stub(lock_file: tmp_lock_file_path)
+ end
+
it "should raise exception if operation lasts more then timeout" do
key = GitlabKeys.new
expect do
@@ -201,4 +208,8 @@ describe GitlabKeys do
def tmp_authorized_keys_path
File.join(ROOT_PATH, 'tmp', 'authorized_keys')
end
+
+ def tmp_lock_file_path
+ tmp_authorized_keys_path + '.lock'
+ end
end