summaryrefslogtreecommitdiff
path: root/spec/gitlab_keys_spec.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2013-11-25 15:08:05 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2013-11-25 15:14:12 +0100
commitd7e1deb195edbce8d4557b07c9f89e612c999ff2 (patch)
tree89b9a5b540ca203f306a029a5315d6b2c1cdea60 /spec/gitlab_keys_spec.rb
parent559196cb27bc524db81e21ac4d890fd695961d14 (diff)
downloadgitlab-shell-d7e1deb195edbce8d4557b07c9f89e612c999ff2.tar.gz
Stub file writing in tests
Diffstat (limited to 'spec/gitlab_keys_spec.rb')
-rw-r--r--spec/gitlab_keys_spec.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/spec/gitlab_keys_spec.rb b/spec/gitlab_keys_spec.rb
index 20768e2..e86874a 100644
--- a/spec/gitlab_keys_spec.rb
+++ b/spec/gitlab_keys_spec.rb
@@ -53,13 +53,17 @@ describe GitlabKeys do
File.read(tmp_authorized_keys_path).should == "existing content\n#{other_line}\n"
end
- it "should log an rm-key event" do
- $logger.should_receive(:info).with('Removing key key-741')
- gitlab_keys.send :rm_key
- end
+ context "without file writing" do
+ before { Tempfile.stub(:open) }
- it "should return true" do
- gitlab_keys.send(:rm_key).should be_true
+ it "should log an rm-key event" 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
end
@@ -67,6 +71,7 @@ describe GitlabKeys do
let(:gitlab_keys) { build_gitlab_keys('clear') }
it "should return true" do
+ gitlab_keys.stub(:open)
gitlab_keys.send(:clear).should be_true
end
end