Skip to content

Commit

Permalink
(MAINT) Fixup failing template_ref specs on older Rubies
Browse files Browse the repository at this point in the history
  • Loading branch information
scotje committed Aug 21, 2020
1 parent 6cb1b08 commit a76ee00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions spec/acceptance/template_ref_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'pdk', 'new', 'module', 'foo',
'--skip-interview',
'--template-url', 'https://github.com/puppetlabs/pdk-templates',
'--template-ref', '1.7.0'
'--template-ref', '1.9.0'
]

around(:each) do |example|
Expand All @@ -33,20 +33,20 @@
describe file('foo/metadata.json') do
it { is_expected.to be_file }
its(:content_as_json) do
is_expected.to include('template-ref' => match(%r{1\.7\.0}))
is_expected.to include('template-ref' => match(%r{1\.9\.0}))
end
end
end

context 'and then updating the module to a specific ref' do
before(:all) { Dir.chdir('foo') }

describe command('pdk update --template-ref 1.8.0 --force') do
describe command('pdk update --template-ref 1.10.0 --force') do
its(:exit_status) { is_expected.to eq(0) }

describe file('metadata.json') do
its(:content_as_json) do
is_expected.to include('template-ref' => match(%r{1\.8\.0}))
is_expected.to include('template-ref' => match(%r{1\.10\.0}))
end
end
end
Expand Down
7 changes: 6 additions & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ def execute_script(script)
analytics_config.unlink
end

c.after(:each) do
c.after(:each) do |e|
# Dump stderr into error message to help with debugging if test failed
if e.exception
e.exception.message << "\nDumping stderr output:\n\n#{subject.stderr}\n" if subject.stderr != ''
end

# recover bundle environment from serverspec munging
bundler_env.keys.each do |k|
ENV[k] = bundler_env[k]
Expand Down

0 comments on commit a76ee00

Please sign in to comment.