aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJosh Cooper <josh@puppet.com>2018-11-27 16:49:54 -0800
committerJosh Cooper <josh@puppet.com>2018-11-28 11:45:17 -0800
commit15696869bc4b62b47b5e6b873694635b2dc86c0d (patch)
tree50a4e412de3839e45d691ce355992b001a03aaf7 /spec
parentc7b2e899ca57fcb6384bee900fa446bc2f860c2a (diff)
downloadpuppet-sshkeys_core-15696869bc4b62b47b5e6b873694635b2dc86c0d.tar.gz
puppet-sshkeys_core-15696869bc4b62b47b5e6b873694635b2dc86c0d.tar.bz2
Account for pre-5 behavior
In Puppet4, the Report class requires a kind argument. Also the is_to_s and should_to_s methods returned an array of strings and a flattened array as a string. That behavior was changed in PUP-7616 (commit c14b28f9c427) so that both methods return a string as the name implies.
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/puppet_spec/compiler.rb6
-rw-r--r--spec/unit/type/ssh_authorized_key_spec.rb6
2 files changed, 9 insertions, 3 deletions
diff --git a/spec/lib/puppet_spec/compiler.rb b/spec/lib/puppet_spec/compiler.rb
index 49a6534..4170b31 100644
--- a/spec/lib/puppet_spec/compiler.rb
+++ b/spec/lib/puppet_spec/compiler.rb
@@ -29,12 +29,16 @@ module PuppetSpec::Compiler
end
def apply_compiled_manifest(manifest, prioritizer = Puppet::Graph::SequentialPrioritizer.new)
+ args = []
+ if Puppet.version.to_f < 5.0
+ args << 'apply'
+ end
catalog = compile_to_ral(manifest)
if block_given?
catalog.resources.each { |res| yield res }
end
transaction = Puppet::Transaction.new(catalog,
- Puppet::Transaction::Report.new,
+ Puppet::Transaction::Report.new(*args),
prioritizer)
transaction.evaluate
transaction.report.finalize_report
diff --git a/spec/unit/type/ssh_authorized_key_spec.rb b/spec/unit/type/ssh_authorized_key_spec.rb
index e375f58..866c688 100644
--- a/spec/unit/type/ssh_authorized_key_spec.rb
+++ b/spec/unit/type/ssh_authorized_key_spec.rb
@@ -141,12 +141,14 @@ describe Puppet::Type.type(:ssh_authorized_key), unless: Puppet.features.microso
it 'property should return well formed string of arrays from is_to_s' do
resource = described_class.new(name: 'whev', type: :rsa, user: 'nobody', options: ['a', 'b', 'c'])
- expect(resource.property(:options).is_to_s(['a', 'b', 'c'])).to eq "['a', 'b', 'c']"
+ str = (Puppet.version.to_f < 5.0) ? ['a', 'b', 'c'] : "['a', 'b', 'c']"
+ expect(resource.property(:options).is_to_s(['a', 'b', 'c'])).to eq(str)
end
it 'property should return well formed string of arrays from should_to_s' do
resource = described_class.new(name: 'whev', type: :rsa, user: 'nobody', options: ['a', 'b', 'c'])
- expect(resource.property(:options).should_to_s(['a', 'b', 'c'])).to eq "['a', 'b', 'c']"
+ str = (Puppet.version.to_f < 5.0) ? 'a b c' : "['a', 'b', 'c']"
+ expect(resource.property(:options).should_to_s(['a', 'b', 'c'])).to eq(str)
end
end