serverspec 2.34.0 → 2.35.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf7439e1ec9e7900ebd5a395bc1e63e1cb0359b1
4
- data.tar.gz: a8c845da7060aabd77ba705c58dcb462e29b3974
3
+ metadata.gz: 609cc80dcfdad218ce5f7d2956aa32ba29c8980a
4
+ data.tar.gz: 05f826f398abb44f97607c418f793073278fcbe6
5
5
  SHA512:
6
- metadata.gz: c8fb0b89e757f2b9783d988cc03294e0108f5bdfbb1c5d80fdaa137d43807eebda7fcfae5ec513787510fec09e1f2b9576538510e680e336817784f49691d4a9
7
- data.tar.gz: 8b1b314700022e1c914a55824777167fe014747674c50a49cbd3907067ef4bd6b96bcebbdd865298324c5c17f77de062cba1da0f841e0f55e166ee1fb13cbbf6
6
+ metadata.gz: 1e934fe845e12bfa2595bc9cb0fbc398c4447048db1d0191c5faec12c09db5d8b4f1a5a1763047e6fda40891bd9d4596ba1534ff89373a6de882a0ae9d94570b
7
+ data.tar.gz: 2223c7bc8076116961b5ac8a143d2affe31db54818a2397ae7b181a96a91ae3eba8a51befef7ba424d6c0ff2220d563ce2ea6ce0cb32991f30b70fbd72550561
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "2.34.0"
2
+ VERSION = "2.35.0"
3
3
  end
@@ -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.34.0
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-06 00:00:00.000000000 Z
11
+ date: 2016-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec