Skip to content

Commit 96e10dc

Browse files
committed
(CONT-228) Update acceptance tests
This commit updates the acceptance tests to reflect the removals in the previous commit.
1 parent 667d10b commit 96e10dc

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

spec/acceptance/emit_json_options_spec.rb renamed to spec/acceptance/generate_json_spec.rb

+9-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require 'spec_helper_acceptance'
44

5-
describe 'Emitting JSON' do
5+
describe 'Generating JSON' do
66
let(:test_module_path) do
77
sut_module_path(%r{Module test})
88
end
@@ -50,26 +50,15 @@
5050
}
5151
end
5252

53-
[
54-
{ title: '--format json and STDOUT', cmd_line: '--format json' },
55-
{ title: '--emit-json-stdout', cmd_line: '--emit-json-stdout' },
56-
].each do |testcase|
57-
it "emits JSON to stdout when using #{testcase[:title]}" do
58-
output = run_shell("puppet strings generate #{testcase[:cmd_line]} \"#{test_module_path}/lib/puppet/parser/functions/function3x.rb\"").stdout.chomp
59-
expect(JSON.parse(output)).to eq(expected)
60-
end
53+
it 'renders JSON to stdout when using --format json' do
54+
output = run_shell("puppet strings generate --format json \"#{test_module_path}/lib/puppet/parser/functions/function3x.rb\"").stdout.chomp
55+
expect(JSON.parse(output)).to eq(expected)
6156
end
6257

63-
[
64-
{ title: '--format json and --out', cmd_line: '--format json --out "TMPFILE"' },
65-
{ title: '--emit-json', cmd_line: '--emit-json "TMPFILE"' },
66-
].each do |testcase|
67-
it "writes JSON to a file when using #{testcase[:title]}" do
68-
tmpfile = File.join(remote_tmp_path, 'json_output.json')
69-
cmd = "puppet strings generate #{testcase[:cmd_line].gsub('TMPFILE', tmpfile)} \"#{test_module_path}/lib/puppet/parser/functions/function3x.rb\""
70-
run_shell(cmd)
71-
output = JSON.parse(file(tmpfile).content)
72-
expect(output).to eq(expected)
73-
end
58+
it 'writes JSON to a file when using --format json --out' do
59+
tmpfile = File.join(remote_tmp_path, 'json_output.json')
60+
run_shell("puppet strings generate --format json --out #{tmpfile} \"#{test_module_path}/lib/puppet/parser/functions/function3x.rb\"")
61+
output = JSON.parse(file(tmpfile).content)
62+
expect(file(tmpfile)).to contain expected
7463
end
7564
end

0 commit comments

Comments
 (0)