serverspec 2.34.0 → 2.35.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 +7 -4
- data/lib/serverspec/version.rb +1 -1
- data/spec/type/base/file_spec.rb +19 -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: 609cc80dcfdad218ce5f7d2956aa32ba29c8980a
|
4
|
+
data.tar.gz: 05f826f398abb44f97607c418f793073278fcbe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e934fe845e12bfa2595bc9cb0fbc398c4447048db1d0191c5faec12c09db5d8b4f1a5a1763047e6fda40891bd9d4596ba1534ff89373a6de882a0ae9d94570b
|
7
|
+
data.tar.gz: 2223c7bc8076116961b5ac8a143d2affe31db54818a2397ae7b181a96a91ae3eba8a51befef7ba424d6c0ff2220d563ce2ea6ce0cb32991f30b70fbd72550561
|
data/lib/serverspec/type/file.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'multi_json'
|
3
|
+
require 'yaml'
|
3
4
|
|
4
5
|
module Serverspec::Type
|
5
6
|
class File < Base
|
@@ -115,13 +116,15 @@ module Serverspec::Type
|
|
115
116
|
end
|
116
117
|
|
117
118
|
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
|
119
|
+
@content_as_json = MultiJson.load(content) if @content_as_json.nil?
|
122
120
|
@content_as_json
|
123
121
|
end
|
124
122
|
|
123
|
+
def content_as_yaml
|
124
|
+
@content_as_yaml = YAML.load(content) if @content_as_yaml.nil?
|
125
|
+
@content_as_yaml
|
126
|
+
end
|
127
|
+
|
125
128
|
def group
|
126
129
|
@runner.get_file_owner_group(@name).stdout.strip
|
127
130
|
end
|
data/lib/serverspec/version.rb
CHANGED
data/spec/type/base/file_spec.rb
CHANGED
@@ -365,6 +365,25 @@ EOF
|
|
365
365
|
its(:content_as_json) { should include('json' => include('array' => include('title' => 'array 2'))) }
|
366
366
|
end
|
367
367
|
|
368
|
+
describe file('example.yml') do
|
369
|
+
let(:stdout) {<<EOF
|
370
|
+
---
|
371
|
+
yaml:
|
372
|
+
title: 'this is a yaml'
|
373
|
+
array:
|
374
|
+
-
|
375
|
+
title: 'array 1'
|
376
|
+
-
|
377
|
+
title: 'array 2'
|
378
|
+
EOF
|
379
|
+
}
|
380
|
+
|
381
|
+
its(:content_as_yaml) { should include('yaml') }
|
382
|
+
its(:content_as_yaml) { should include('yaml' => include('title' => 'this is a yaml')) }
|
383
|
+
its(:content_as_yaml) { should include('yaml' => include('array' => include('title' => 'array 2'))) }
|
384
|
+
end
|
385
|
+
|
386
|
+
|
368
387
|
describe file('/etc/pam.d/system-auth') do
|
369
388
|
let(:stdout) { "/etc/pam.dsystem-auth-ac\r\n" }
|
370
389
|
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.35.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-05-
|
11
|
+
date: 2016-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|