diff --git a/Gemfile b/Gemfile index 8c6384f04..22edfd4fb 100644 --- a/Gemfile +++ b/Gemfile @@ -23,8 +23,11 @@ group :test do end group :acceptance do - # Litmus has dependencies which require Ruby 2.5 (Puppet 6) or above. - gem 'puppet_litmus' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.5.0') + if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.5.0') + # Litmus has dependencies which require Ruby 2.5 (Puppet 6) or above. + gem 'puppet_litmus', '~> 0.11', '>= 0.11.1' + gem 'net-ssh', '~> 5.2' + end end group :development do diff --git a/spec/acceptance/emit_json_options_spec.rb b/spec/acceptance/emit_json_options_spec.rb index b6da4bf8a..3c8663583 100644 --- a/spec/acceptance/emit_json_options_spec.rb +++ b/spec/acceptance/emit_json_options_spec.rb @@ -49,7 +49,7 @@ { :title => '--emit-json-stdout', :cmd_line => '--emit-json-stdout' } ].each do |testcase| it "should emit JSON to stdout when using #{testcase[:title]}" do - output = PuppetLitmus::Serverspec.run_shell("puppet strings generate #{testcase[:cmd_line]} \"#{@test_module_path}/lib/puppet/parser/functions/function3x.rb\"").stdout.chomp + output = PuppetLitmus::PuppetHelpers.run_shell("puppet strings generate #{testcase[:cmd_line]} \"#{@test_module_path}/lib/puppet/parser/functions/function3x.rb\"").stdout.chomp expect(JSON.parse(output)).to eq(expected) end end @@ -61,7 +61,7 @@ it "should write JSON to a file when using #{testcase[:title]}" do tmpfile = File.join(@remote_tmp_path, 'json_output.json') cmd = "puppet strings generate #{testcase[:cmd_line].gsub('TMPFILE', tmpfile)} \"#{@test_module_path}/lib/puppet/parser/functions/function3x.rb\"" - PuppetLitmus::Serverspec.run_shell(cmd) + PuppetLitmus::PuppetHelpers.run_shell(cmd) output = JSON.parse(file(tmpfile).content) expect(output).to eq(expected) end diff --git a/spec/acceptance/generate_markdown_spec.rb b/spec/acceptance/generate_markdown_spec.rb index fbb265856..ac4c749db 100644 --- a/spec/acceptance/generate_markdown_spec.rb +++ b/spec/acceptance/generate_markdown_spec.rb @@ -35,13 +35,13 @@ class { "test": } it 'should render Markdown to stdout when using --format markdown' do skip('This test is broken. Does not output to STDOUT by default.') - output = PuppetLitmus::Serverspec.run_shell("puppet strings generate --format markdown \"#{@test_module_path}/manifests/init.pp\"").stdout.chomp + output = PuppetLitmus::PuppetHelpers.run_shell("puppet strings generate --format markdown \"#{@test_module_path}/manifests/init.pp\"").stdout.chomp expect(output).to eq(expected) end it 'should write Markdown to a file when using --format markdown and --out' do tmpfile = File.join(@remote_tmp_path, 'md_output.md') - remote = PuppetLitmus::Serverspec.run_shell("puppet strings generate --format markdown --out \"#{tmpfile}\" \"#{@test_module_path}/manifests/init.pp\"") + remote = PuppetLitmus::PuppetHelpers.run_shell("puppet strings generate --format markdown --out \"#{tmpfile}\" \"#{@test_module_path}/manifests/init.pp\"") expect(file(tmpfile)).to contain expected end end diff --git a/spec/acceptance/running_strings_generate_spec.rb b/spec/acceptance/running_strings_generate_spec.rb index cd35352d6..c51e56e31 100644 --- a/spec/acceptance/running_strings_generate_spec.rb +++ b/spec/acceptance/running_strings_generate_spec.rb @@ -4,10 +4,10 @@ describe 'Generating module documentation using generate action' do before :all do # TODO: Linux only - @sut_work_dir = PuppetLitmus::Serverspec.run_shell("pwd").stdout.chomp + @sut_work_dir = PuppetLitmus::PuppetHelpers.run_shell("pwd").stdout.chomp test_module_path = sut_module_path(/Module test/) - PuppetLitmus::Serverspec.run_shell("puppet strings generate \"#{test_module_path}/**/*.{rb,pp}\"") + PuppetLitmus::PuppetHelpers.run_shell("puppet strings generate \"#{test_module_path}/**/*.{rb,pp}\"") end def expect_file_contain(path, expected_contents) diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index 50b0a3392..cd90ed8c2 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -1,5 +1,5 @@ def sut_module_path(module_regex) - modules = JSON.parse(PuppetLitmus::Serverspec.run_shell('puppet module list --render-as json').stdout) + modules = JSON.parse(PuppetLitmus::PuppetHelpers.run_shell('puppet module list --render-as json').stdout) test_module_info = modules['modules_by_path'].values.flatten.find { |mod_info| mod_info =~ module_regex } test_module_info.match(/\(([^)]*)\)/)[1] end