diff options
author | mh <mh@immerda.ch> | 2014-01-26 15:25:48 +0100 |
---|---|---|
committer | mh <mh@immerda.ch> | 2014-01-26 15:25:48 +0100 |
commit | a9f0dad383bb1c9f8e1dfc2e766e0871b6c35be4 (patch) | |
tree | 799ca58f7f83bcc123cb004dfa272585531a0f6d /spec/functions | |
parent | f7ae144165033a8afb0ed37da32a9e59fd627c34 (diff) | |
download | puppet-sshd-a9f0dad383bb1c9f8e1dfc2e766e0871b6c35be4.tar.gz puppet-sshd-a9f0dad383bb1c9f8e1dfc2e766e0871b6c35be4.tar.bz2 |
fix broken tests
These tests were broken before, because they didn't mock the right
method.
Diffstat (limited to 'spec/functions')
-rw-r--r-- | spec/functions/ssh_keygen_spec.rb | 12 |
1 files 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)) |