From a9f0dad383bb1c9f8e1dfc2e766e0871b6c35be4 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 26 Jan 2014 15:25:48 +0100 Subject: fix broken tests These tests were broken before, because they didn't mock the right method. --- spec/functions/ssh_keygen_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/functions/ssh_keygen_spec.rb b/spec/functions/ssh_keygen_spec.rb index 0d2100d..a6b5117 100644 --- a/spec/functions/ssh_keygen_spec.rb +++ b/spec/functions/ssh_keygen_spec.rb @@ -80,34 +80,34 @@ describe 'ssh_keygen' do result[1].should == 'publickey' end - xit "should create the directory path if it does not exist" do + it "should create the directory path if it does not exist" do File.stubs(:exists?).with("/tmp/a/b/c").returns(false) File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(false) File.stubs(:directory?).with("/tmp/a/b").returns(false) FileUtils.expects(:mkdir_p).with("/tmp/a/b", :mode => 0700) - Puppet::Util.expects(:execute).returns("") + Puppet::Util::Execution.expects(:execute).returns("") result = scope.function_ssh_keygen(['/tmp/a/b/c']) result.length.should == 2 result[0].should == 'privatekey' result[1].should == 'publickey' end - xit "should generate the key if the keyfiles do not exist" do + it "should generate the key if the keyfiles do not exist" do File.stubs(:exists?).with("/tmp/a/b/c").returns(false) File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(false) File.stubs(:directory?).with("/tmp/a/b").returns(true) - Puppet::Util.expects(:execute).with(['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', '-f', '/tmp/a/b/c', '-P', '', '-q']).returns("") + Puppet::Util::Execution.expects(:execute).with(['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', '-f', '/tmp/a/b/c', '-P', '', '-q']).returns("") result = scope.function_ssh_keygen(['/tmp/a/b/c']) result.length.should == 2 result[0].should == 'privatekey' result[1].should == 'publickey' end - xit "should fail if something goes wrong during generation" do + it "should fail if something goes wrong during generation" do File.stubs(:exists?).with("/tmp/a/b/c").returns(false) File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(false) File.stubs(:directory?).with("/tmp/a/b").returns(true) - Puppet::Util.expects(:execute).with(['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', '-f', '/tmp/a/b/c', '-P', '', '-q']).returns("something is wrong") + Puppet::Util::Execution.expects(:execute).with(['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', '-f', '/tmp/a/b/c', '-P', '', '-q']).returns("something is wrong") lambda { scope.function_ssh_keygen(["/tmp/a/b/c"]) }.should( raise_error(Puppet::ParseError)) -- cgit v1.2.3