serverspec 2.33.0 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/serverspec/type/file.rb +9 -0
- data/lib/serverspec/version.rb +1 -1
- data/spec/type/base/file_spec.rb +23 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf7439e1ec9e7900ebd5a395bc1e63e1cb0359b1
|
4
|
+
data.tar.gz: a8c845da7060aabd77ba705c58dcb462e29b3974
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8fb0b89e757f2b9783d988cc03294e0108f5bdfbb1c5d80fdaa137d43807eebda7fcfae5ec513787510fec09e1f2b9576538510e680e336817784f49691d4a9
|
7
|
+
data.tar.gz: 8b1b314700022e1c914a55824777167fe014747674c50a49cbd3907067ef4bd6b96bcebbdd865298324c5c17f77de062cba1da0f841e0f55e166ee1fb13cbbf6
|
data/lib/serverspec/type/file.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'date'
|
2
|
+
require 'multi_json'
|
2
3
|
|
3
4
|
module Serverspec::Type
|
4
5
|
class File < Base
|
@@ -113,6 +114,14 @@ module Serverspec::Type
|
|
113
114
|
@content
|
114
115
|
end
|
115
116
|
|
117
|
+
def content_as_json
|
118
|
+
if @content_as_json.nil?
|
119
|
+
@content = @runner.get_file_content(@name).stdout if @content.nil?
|
120
|
+
@content_as_json = MultiJson.load(@content)
|
121
|
+
end
|
122
|
+
@content_as_json
|
123
|
+
end
|
124
|
+
|
116
125
|
def group
|
117
126
|
@runner.get_file_owner_group(@name).stdout.strip
|
118
127
|
end
|
data/lib/serverspec/version.rb
CHANGED
data/spec/type/base/file_spec.rb
CHANGED
@@ -342,6 +342,29 @@ EOF
|
|
342
342
|
its(:content) { should match /root:x:0:0/ }
|
343
343
|
end
|
344
344
|
|
345
|
+
describe file('example.json') do
|
346
|
+
let(:stdout) {<<EOF
|
347
|
+
{
|
348
|
+
"json": {
|
349
|
+
"title": "this is a json",
|
350
|
+
"array" : [
|
351
|
+
{
|
352
|
+
"title": "array 1"
|
353
|
+
},
|
354
|
+
{
|
355
|
+
"title": "array 2"
|
356
|
+
}
|
357
|
+
]
|
358
|
+
}
|
359
|
+
}
|
360
|
+
EOF
|
361
|
+
}
|
362
|
+
|
363
|
+
its(:content_as_json) { should include('json') }
|
364
|
+
its(:content_as_json) { should include('json' => include('title' => 'this is a json')) }
|
365
|
+
its(:content_as_json) { should include('json' => include('array' => include('title' => 'array 2'))) }
|
366
|
+
end
|
367
|
+
|
345
368
|
describe file('/etc/pam.d/system-auth') do
|
346
369
|
let(:stdout) { "/etc/pam.dsystem-auth-ac\r\n" }
|
347
370
|
its(:link_target) { should eq '/etc/pam.dsystem-auth-ac' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.34.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|