summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-19 11:13:51 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-19 11:13:51 +0000
commitf13afa2db3f3b44a9a6f97b88eced3f324f80b51 (patch)
treebcdaab260a4016ac767318b3da064a6f365eb71f /spec
parentf31c38e8ea62c862e5d5bc29b4a2984ed608c2a1 (diff)
parent4de0ee3b8fbdbcc215b0e23ef87c7a97eadadafd (diff)
downloadgitlab-shell-f13afa2db3f3b44a9a6f97b88eced3f324f80b51.tar.gz
Merge branch 'avoid_sed_i' of /home/git/repositories/gitlab/gitlab-shell
Diffstat (limited to 'spec')
-rw-r--r--spec/gitlab_keys_spec.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/spec/gitlab_keys_spec.rb b/spec/gitlab_keys_spec.rb
index 09f5872..c888b8e 100644
--- a/spec/gitlab_keys_spec.rb
+++ b/spec/gitlab_keys_spec.rb
@@ -31,9 +31,12 @@ describe GitlabKeys do
describe :rm_key do
let(:gitlab_keys) { build_gitlab_keys('rm-key', 'key-741', 'ssh-rsa AAAAB3NzaDAxx2E') }
+ let(:temp_file) { mock(:temp_file, path: 'tmp_path') }
+ before { Tempfile.should_receive(:open).and_yield(temp_file) }
it "should receive valid cmd" do
- valid_cmd = "sed -i '/shell key-741\"/d' #{GitlabConfig.new.auth_file}"
+ auth_file = GitlabConfig.new.auth_file
+ valid_cmd = "sed '/shell key-741\"/d' #{auth_file} > tmp_path && mv tmp_path #{auth_file}"
gitlab_keys.should_receive(:system).with(valid_cmd)
gitlab_keys.send :rm_key
end