Skip to content

Commit 67fb84a

Browse files
committed
(PDOC-184) acceptance test
1 parent 9a4b32e commit 67fb84a

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
require 'spec_helper_acceptance'
2+
require 'util'
3+
require 'json'
4+
5+
include PuppetStrings::Acceptance::Util
6+
7+
describe 'Generating Markdown' do
8+
expected = <<-EOF
9+
# Reference
10+
11+
## Classes
12+
* [`test`](#test): This class exists to serve as fixture data for testing the puppet strings face
13+
14+
## Classes
15+
16+
### test
17+
18+
#### Examples
19+
```puppet
20+
class { "test": }
21+
```
22+
23+
#### Parameters
24+
25+
##### `package_name`
26+
27+
The name of the package
28+
29+
##### `service_name`
30+
31+
The name of the service
32+
33+
EOF
34+
35+
it 'should render Markdown to stdout when using --format markdown and --stdout' do
36+
test_module_path = get_test_module_path(master, /Module test/)
37+
on master, puppet('strings', 'generate', '--format markdown', '--stdout', "#{test_module_path}/manifests/init.pp") do
38+
output = stdout.chomp
39+
expect(JSON.parse(output)).to eq(expected)
40+
end
41+
end
42+
43+
it 'should write Markdown to a file when using --format markdown and --out' do
44+
test_module_path = get_test_module_path(master, /Module test/)
45+
tmpfile = master.tmpfile('json_output.json')
46+
on master, puppet('strings', 'generate', '--format markdown', "--out #{tmpfile}", "#{test_module_path}/manifests/init.pp")
47+
output = read_file_on(master, tmpfile)
48+
expect(JSON.parse(output)).to eq(expected)
49+
end
50+
end

0 commit comments

Comments
 (0)