inspec 0.20.1 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +45 -2
- data/docs/dsl_inspec.rst +2 -2
- data/docs/resources.rst +9 -9
- data/docs/ruby_usage.rst +145 -0
- data/inspec.gemspec +1 -0
- data/lib/bundles/inspec-compliance/cli.rb +15 -2
- data/lib/inspec/cli.rb +23 -10
- data/lib/inspec/dsl.rb +0 -52
- data/lib/inspec/objects/or_test.rb +1 -0
- data/lib/inspec/objects/test.rb +4 -4
- data/lib/inspec/profile.rb +76 -61
- data/lib/inspec/profile_context.rb +12 -11
- data/lib/inspec/rspec_json_formatter.rb +93 -40
- data/lib/inspec/rule.rb +7 -29
- data/lib/inspec/runner.rb +15 -4
- data/lib/inspec/runner_mock.rb +1 -1
- data/lib/inspec/runner_rspec.rb +26 -24
- data/lib/inspec/version.rb +1 -1
- data/lib/matchers/matchers.rb +3 -3
- data/lib/resources/auditd_rules.rb +2 -2
- data/lib/resources/host.rb +1 -1
- data/lib/resources/interface.rb +1 -1
- data/lib/resources/kernel_parameter.rb +1 -1
- data/lib/resources/mount.rb +2 -1
- data/lib/resources/mysql_session.rb +1 -1
- data/lib/resources/os_env.rb +2 -2
- data/lib/resources/passwd.rb +33 -93
- data/lib/resources/port.rb +47 -3
- data/lib/resources/processes.rb +3 -3
- data/lib/resources/service.rb +33 -1
- data/lib/resources/user.rb +15 -15
- data/lib/utils/base_cli.rb +1 -3
- data/lib/utils/filter.rb +30 -7
- data/test/cookbooks/os_prepare/recipes/_upstart_service_centos.rb +4 -0
- data/test/functional/helper.rb +1 -0
- data/test/functional/inheritance_test.rb +1 -1
- data/test/functional/inspec_compliance_test.rb +4 -3
- data/test/functional/inspec_exec_json_test.rb +122 -0
- data/test/functional/inspec_exec_test.rb +23 -117
- data/test/functional/{inspec_json_test.rb → inspec_json_profile_test.rb} +13 -15
- data/test/functional/inspec_test.rb +15 -2
- data/test/helper.rb +5 -1
- data/test/integration/default/auditd_rules_spec.rb +3 -3
- data/test/integration/default/kernel_parameter_spec.rb +6 -6
- data/test/integration/default/service_spec.rb +4 -0
- data/test/resource/command_test.rb +9 -9
- data/test/resource/dsl_test.rb +1 -1
- data/test/resource/file_test.rb +17 -17
- data/test/unit/control_test.rb +1 -1
- data/test/unit/mock/cmd/hpux-netstat-inet +10 -0
- data/test/unit/mock/cmd/hpux-netstat-inet6 +11 -0
- data/test/unit/mock/profiles/skippy-profile-os/controls/one.rb +1 -1
- data/test/unit/profile_context_test.rb +2 -2
- data/test/unit/profile_test.rb +11 -14
- data/test/unit/resources/passwd_test.rb +13 -14
- data/test/unit/resources/port_test.rb +14 -0
- data/test/unit/resources/processes_test.rb +3 -3
- data/test/unit/resources/service_test.rb +103 -39
- data/test/unit/utils/filter_table_test.rb +35 -3
- metadata +25 -4
@@ -7,9 +7,9 @@ require 'helper'
|
|
7
7
|
|
8
8
|
describe FilterTable do
|
9
9
|
let (:data) {[
|
10
|
-
{ foo: 3, bar: true, baz: 'yay', num: nil },
|
11
|
-
{ foo: 2, bar: false, baz: 'noo', num: 1 },
|
12
|
-
{ foo: 2, bar: false, baz: 'whatever', num: 2 },
|
10
|
+
{ foo: 3, bar: true, baz: 'yay', num: nil, snum: "0" },
|
11
|
+
{ foo: 2, bar: false, baz: 'noo', num: 1, snum: nil },
|
12
|
+
{ foo: 2, bar: false, baz: 'whatever', num: 2, snum: "1.00" },
|
13
13
|
]}
|
14
14
|
|
15
15
|
let (:resource) {
|
@@ -103,6 +103,38 @@ describe FilterTable do
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
+
describe 'with the string-number field' do
|
107
|
+
before { factory.add(:snum).connect(resource, :data) }
|
108
|
+
|
109
|
+
it 'retrieves the number 0' do
|
110
|
+
instance.snum(0).params.must_equal [data[0]]
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'retrieves the number 1' do
|
114
|
+
instance.snum(1).params.must_equal []
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe 'with the string-float field' do
|
119
|
+
before { factory.add(:snum).connect(resource, :data) }
|
120
|
+
|
121
|
+
it 'retrieves the float 0.0' do
|
122
|
+
instance.snum(0.0).params.must_equal [data[0]]
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'retrieves the float 1.0' do
|
126
|
+
instance.snum(1.0).params.must_equal [data[2]]
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe 'with a regex check' do
|
131
|
+
before { factory.add(:baz).connect(resource, :data) }
|
132
|
+
|
133
|
+
it 'retrieves the number 0' do
|
134
|
+
instance.baz(/ever$/).params.must_equal [data[2]]
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
106
138
|
describe 'with the string field' do
|
107
139
|
before { factory.add(:baz).connect(resource, :data) }
|
108
140
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: r-train
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: hashie
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '3.4'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.4'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: mocha
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +192,7 @@ files:
|
|
178
192
|
- docs/profiles.rst
|
179
193
|
- docs/readme.rst
|
180
194
|
- docs/resources.rst
|
195
|
+
- docs/ruby_usage.rst
|
181
196
|
- docs/template.rst
|
182
197
|
- examples/README.md
|
183
198
|
- examples/inheritance/README.md
|
@@ -377,8 +392,9 @@ files:
|
|
377
392
|
- test/functional/inheritance_test.rb
|
378
393
|
- test/functional/inspec_archive_test.rb
|
379
394
|
- test/functional/inspec_compliance_test.rb
|
395
|
+
- test/functional/inspec_exec_json_test.rb
|
380
396
|
- test/functional/inspec_exec_test.rb
|
381
|
-
- test/functional/
|
397
|
+
- test/functional/inspec_json_profile_test.rb
|
382
398
|
- test/functional/inspec_test.rb
|
383
399
|
- test/helper.rb
|
384
400
|
- test/integration/default/_debug_spec.rb
|
@@ -455,6 +471,8 @@ files:
|
|
455
471
|
- test/unit/mock/cmd/getent-hosts-example.com
|
456
472
|
- test/unit/mock/cmd/getent-passwd-jfolmer
|
457
473
|
- test/unit/mock/cmd/getent-passwd-root
|
474
|
+
- test/unit/mock/cmd/hpux-netstat-inet
|
475
|
+
- test/unit/mock/cmd/hpux-netstat-inet6
|
458
476
|
- test/unit/mock/cmd/id-chartmann
|
459
477
|
- test/unit/mock/cmd/id-jfolmer
|
460
478
|
- test/unit/mock/cmd/id-root
|
@@ -648,8 +666,9 @@ test_files:
|
|
648
666
|
- test/functional/inheritance_test.rb
|
649
667
|
- test/functional/inspec_archive_test.rb
|
650
668
|
- test/functional/inspec_compliance_test.rb
|
669
|
+
- test/functional/inspec_exec_json_test.rb
|
651
670
|
- test/functional/inspec_exec_test.rb
|
652
|
-
- test/functional/
|
671
|
+
- test/functional/inspec_json_profile_test.rb
|
653
672
|
- test/functional/inspec_test.rb
|
654
673
|
- test/helper.rb
|
655
674
|
- test/integration/default/_debug_spec.rb
|
@@ -726,6 +745,8 @@ test_files:
|
|
726
745
|
- test/unit/mock/cmd/getent-hosts-example.com
|
727
746
|
- test/unit/mock/cmd/getent-passwd-jfolmer
|
728
747
|
- test/unit/mock/cmd/getent-passwd-root
|
748
|
+
- test/unit/mock/cmd/hpux-netstat-inet
|
749
|
+
- test/unit/mock/cmd/hpux-netstat-inet6
|
729
750
|
- test/unit/mock/cmd/id-chartmann
|
730
751
|
- test/unit/mock/cmd/id-jfolmer
|
731
752
|
- test/unit/mock/cmd/id-root
|