Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/emit_json_options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/generate_markdown_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions spec/acceptance/running_strings_generate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper_acceptance_local.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down