Commit d7e1deb1 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Stub file writing in tests

parent 559196cb
...@@ -53,13 +53,17 @@ describe GitlabKeys do ...@@ -53,13 +53,17 @@ describe GitlabKeys do
File.read(tmp_authorized_keys_path).should == "existing content\n#{other_line}\n" File.read(tmp_authorized_keys_path).should == "existing content\n#{other_line}\n"
end end
it "should log an rm-key event" do context "without file writing" do
$logger.should_receive(:info).with('Removing key key-741') before { Tempfile.stub(:open) }
gitlab_keys.send :rm_key
end
it "should return true" do it "should log an rm-key event" do
gitlab_keys.send(:rm_key).should be_true $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
end end
...@@ -67,6 +71,7 @@ describe GitlabKeys do ...@@ -67,6 +71,7 @@ describe GitlabKeys do
let(:gitlab_keys) { build_gitlab_keys('clear') } let(:gitlab_keys) { build_gitlab_keys('clear') }
it "should return true" do it "should return true" do
gitlab_keys.stub(:open)
gitlab_keys.send(:clear).should be_true gitlab_keys.send(:clear).should be_true
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment