summaryrefslogtreecommitdiff
path: root/spec/functions/defined_with_params_spec.rb
diff options
context:
space:
mode:
authorDavid Schmitt <david.schmitt@puppetlabs.com>2015-06-01 12:21:59 +0100
committerDavid Schmitt <david.schmitt@puppetlabs.com>2015-06-01 18:02:22 +0100
commitf3e79ddcd56a221c7799b35efde7e9803a5c7923 (patch)
tree730386688574c94169d47d37f79af77c2cda2f08 /spec/functions/defined_with_params_spec.rb
parentb62dff0c6e09faf9bacfb02575e689ed09ee5e56 (diff)
downloadpuppet-stdlib-f3e79ddcd56a221c7799b35efde7e9803a5c7923.tar.gz
puppet-stdlib-f3e79ddcd56a221c7799b35efde7e9803a5c7923.tar.bz2
Convert tests to use plain rspec-puppet
Tests in the new style produces the following documentation output: abs should not eq nil should run abs() and raise an Puppet::ParseError should run abs(-34) and return 34 should run abs("-34") and return 34 should run abs(34) and return 34 should run abs("34") and return 34
Diffstat (limited to 'spec/functions/defined_with_params_spec.rb')
-rwxr-xr-xspec/functions/defined_with_params_spec.rb29
1 files changed, 9 insertions, 20 deletions
diff --git a/spec/functions/defined_with_params_spec.rb b/spec/functions/defined_with_params_spec.rb
index 3590304..516d986 100755
--- a/spec/functions/defined_with_params_spec.rb
+++ b/spec/functions/defined_with_params_spec.rb
@@ -1,37 +1,26 @@
-#! /usr/bin/env ruby -S rspec
require 'spec_helper'
-require 'rspec-puppet'
describe 'defined_with_params' do
- describe 'when a resource is not specified' do
+ describe 'when no resource is specified' do
it { is_expected.to run.with_params().and_raise_error(ArgumentError) }
end
describe 'when compared against a resource with no attributes' do
let :pre_condition do
'user { "dan": }'
end
- it do
- is_expected.to run.with_params('User[dan]', {}).and_return(true)
- is_expected.to run.with_params('User[bob]', {}).and_return(false)
- is_expected.to run.with_params('User[dan]', {'foo' => 'bar'}).and_return(false)
- end
+ it { is_expected.to run.with_params('User[dan]', {}).and_return(true) }
+ it { is_expected.to run.with_params('User[bob]', {}).and_return(false) }
+ it { is_expected.to run.with_params('User[dan]', {'foo' => 'bar'}).and_return(false) }
end
describe 'when compared against a resource with attributes' do
let :pre_condition do
'user { "dan": ensure => present, shell => "/bin/csh", managehome => false}'
end
- it do
- is_expected.to run.with_params('User[dan]', {}).and_return(true)
- is_expected.to run.with_params('User[dan]', '').and_return(true)
- is_expected.to run.with_params('User[dan]', {'ensure' => 'present'}
- ).and_return(true)
- is_expected.to run.with_params('User[dan]',
- {'ensure' => 'present', 'managehome' => false}
- ).and_return(true)
- is_expected.to run.with_params('User[dan]',
- {'ensure' => 'absent', 'managehome' => false}
- ).and_return(false)
- end
+ it { is_expected.to run.with_params('User[dan]', {}).and_return(true) }
+ it { is_expected.to run.with_params('User[dan]', '').and_return(true) }
+ it { is_expected.to run.with_params('User[dan]', {'ensure' => 'present'}).and_return(true) }
+ it { is_expected.to run.with_params('User[dan]', {'ensure' => 'present', 'managehome' => false}).and_return(true) }
+ it { is_expected.to run.with_params('User[dan]', {'ensure' => 'absent', 'managehome' => false}).and_return(false) }
end
end