forked from inspec/inspec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdsl_test.rb
45 lines (39 loc) · 941 Bytes
/
dsl_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
describe command('echo hello') do
its('stdout') { should eq "hello\n" }
end
describe 'describe + it + expect' do
it 'should echo something' do
out = rand.to_s
expect(command("echo -n #{out}").stdout).to eq(out)
end
end
describe 'describe and expect without it' do
it 'will raise an error' do
expect(proc{
describe rand.to_s do
expect(true).to eq(true)
end
}).to raise_error StandardError
end
end
rule 'rule + describe' do
out = rand.to_s
describe command("echo -n #{out}") do
its('stdout') { should eq out }
end
end
rule 'rule + describe + it + expect' do
out = rand.to_s
describe 'a rule' do
it 'must echo something' do
expect(command("echo -n #{out}").stdout).to eq(out)
end
end
end
rule 'rule + expect only' do
out = rand.to_s
expect(command("echo -n #{out}").stdout).to eq(out)
end