spec/acceptance/generate_markdown_spec.rb in puppet-strings-2.2.0 vs spec/acceptance/generate_markdown_spec.rb in puppet-strings-2.3.0

- old
+ new

@@ -1,11 +1,13 @@ require 'spec_helper_acceptance' -require 'util' -include PuppetStrings::Acceptance::Util - describe 'Generating Markdown' do + before(:all) do + @test_module_path = sut_module_path(/Module test/) + @remote_tmp_path = sut_tmp_path + end + expected = <<-EOF # Reference ## Classes * [`test`](#test): This class exists to serve as fixture data for testing the puppet strings face @@ -27,23 +29,19 @@ ##### `service_name` The name of the service -EOF + EOF - it 'should render Markdown to stdout when using --format markdown and --stdout' do - test_module_path = get_test_module_path(master, /Module test/) - on master, puppet('strings', 'generate', '--format markdown', "#{test_module_path}/manifests/init.pp") do - output = stdout.chomp - expect(JSON.parse(output)).to eq(expected) - end + 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 + expect(output).to eq(expected) end it 'should write Markdown to a file when using --format markdown and --out' do - test_module_path = get_test_module_path(master, /Module test/) - tmpfile = master.tmpfile('md_output.md') - on master, puppet('strings', 'generate', '--format markdown', "--out #{tmpfile}", "#{test_module_path}/manifests/init.pp") - output = read_file_on(master, tmpfile) - expect(JSON.parse(output)).to eq(expected) + 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\"") + expect(file(tmpfile)).to contain expected end end