rspec-puppet 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc2b092d4a84ad47ceff22b0123d01b8171ff612
4
- data.tar.gz: eb32c18c64ad5ae96e69f53fc8d2999665784f24
3
+ metadata.gz: 9af746954c13b2c0fa5039fa066faef84c28e846
4
+ data.tar.gz: 3616d46484994eabad338decfdb9c0b8b83cf48f
5
5
  SHA512:
6
- metadata.gz: 4f6909ee0c338d72e1251590bccc3d6a5b34fcc8279158ce1a39a26f3905396e3e6a06284cb92392c7b7aecf8f4c3b7e1a5960189ab3f5d7796afe3c131f49e1
7
- data.tar.gz: ffd7a6073b9afc2d660d061c42450381ff631c77df9f953289c62875e8f12aa5d05889f7a23eafd01a9741e931b6007da82fc17a5cb76538090adcb42ce7b541
6
+ metadata.gz: d86702faa57cca90162ed80d8a39bc2b5bc57452b7daa6defa507c1cd51bddd8e7a44e1a1bebb718997efdb3e1059625c3d14580762d611be6fe42a3680826e2
7
+ data.tar.gz: 530a52d04ef1465361c34b5970d0b0da3f99742e0bd4867f9fd8ffbb7aa8d0fc4c124c890f0a384c003231c52ffaa17c17ac583aa684ea051a236571041cb73b
data/README.md CHANGED
@@ -63,16 +63,6 @@ end
63
63
 
64
64
  ### Matchers
65
65
 
66
- #### Checking if a class has been included
67
-
68
- You can test if a class has been included in the catalogue with the
69
- `include_class` matcher. It takes the class name as a string as its only
70
- argument
71
-
72
- ```ruby
73
- it { should include_class('foo') }
74
- ```
75
-
76
66
  #### Checking if a resource exists
77
67
 
78
68
  You can test if a resource exists in the catalogue with the generic
@@ -82,6 +72,13 @@ You can test if a resource exists in the catalogue with the generic
82
72
  it { should contain_augeas('bleh') }
83
73
  ```
84
74
 
75
+ You can also test if a class has been included in the catalogue with the
76
+ same matcher.
77
+
78
+ ```ruby
79
+ it { should contain_class('foo') }
80
+ ```
81
+
85
82
  If your resource type includes :: (e.g.
86
83
  `foo::bar` simply replace the :: with __ (two underscores).
87
84
 
@@ -27,6 +27,13 @@ module RSpec::Puppet
27
27
  actual = @resource[@parameter]
28
28
  expected = @value
29
29
 
30
+ # Puppet flattens an array with a single value into just the value and
31
+ # this can cause confusion when testing as people expect when you put
32
+ # an array in, you'll get an array out.
33
+ if expected.is_a?(Array) && expected.length == 1
34
+ actual = Array[actual] unless actual.is_a?(Array)
35
+ end
36
+
30
37
  retval = check(expected, actual)
31
38
 
32
39
  unless retval
@@ -6,7 +6,7 @@ module RSpec::Puppet
6
6
  def catalogue(type)
7
7
  vardir = setup_puppet
8
8
 
9
- code = import_str + pre_cond + test_manifest(type)
9
+ code = [import_str, pre_cond, test_manifest(type)].join("\n")
10
10
  node_name = nodename(type)
11
11
 
12
12
  catalogue = build_catalog(node_name, facts_hash(node_name), code)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Sharpe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-05 00:00:00.000000000 Z
11
+ date: 2013-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec