puppetlabs_spec_helper 2.10.0 → 2.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0b2a921cc114d8a5ce52a27f063c8df99910a603
4
- data.tar.gz: d0dfa70b4a9636b1835c52cb21fe526c20ab90cd
2
+ SHA256:
3
+ metadata.gz: a9a1f7716029a379fd8c1d4af904e9093a40b37c4cf38407f82f5aa9e77b5d9a
4
+ data.tar.gz: e466f0292777e6cbda90f0fa1e0e9354d743667405146f2093fe8156b4f7dc81
5
5
  SHA512:
6
- metadata.gz: 0e773f370727f0c26dcabf4bb09285280708aa09cba82a56fae35eeba7f2d2d2319c7e6b394220b4e44088d42c0c926344292d73a1a998e00767342f70bd5769
7
- data.tar.gz: b3696a6a92f84f6506f37f0de8a0bd8194356d826b4e57ed9b5f44fe0eca9ec821f9696c7160d8fcb138ae33669164b5bdc5701696ff3ef05c85e03b2282c785
6
+ metadata.gz: 81a999915c16b01136577bd6535e03c7212e8307a12cbbd58edd44bbe6c3c83d765ea38540ecc5948fcdd7920f51f9132f74deb5114313c55c15d933365f6795
7
+ data.tar.gz: 6ee1c1b51b92f3f52b3cc52dd90c1c9b3f12c20f576432692cef3664860a38f300d44e3c96c8ea26d6ce028e6977e53974be2de1ed9019ccacfae21e8e66613c
data/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All significant changes to this repo will be summarized in this file.
4
4
 
5
5
 
6
+ ## [v2.11.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.11.0) (2018-09-26)
7
+ [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.10.0...v2.11.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - \(MODULES-7856\) Allow optional repositories based on puppet version [\#258](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/258) ([joshcooper](https://github.com/joshcooper))
12
+
13
+ **Fixed bugs:**
14
+
15
+ - Fix example conversion from mocha to rspec mocks. [\#257](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/257) ([vStone](https://github.com/vStone))
16
+
6
17
  ## [v2.10.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.10.0) (2018-08-30)
7
18
  [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.9.1...v2.10.0)
8
19
 
@@ -13,6 +24,7 @@ All significant changes to this repo will be summarized in this file.
13
24
 
14
25
  **Merged pull requests:**
15
26
 
27
+ - \(maint\) - Release prep for 2.10.0 [\#256](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/256) ([tphoney](https://github.com/tphoney))
16
28
  - Update documentation for older Puppet versions [\#254](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/254) ([op-ct](https://github.com/op-ct))
17
29
  - update README [\#252](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/252) ([b4ldr](https://github.com/b4ldr))
18
30
 
data/README.md CHANGED
@@ -191,7 +191,7 @@ file named `.fixtures.yml` in the root of the project. You can specify a alterna
191
191
  You can use the `MODULE_WORKING_DIR` environment variable to specify a diffent location when installing module fixtures via the forge. By default the
192
192
  working directory is `<module directory>/spec/fixtures/work-dir`.
193
193
 
194
- When specifying the repo source of the fixture you have a few options as to which revision of the codebase you wish to use.
194
+ When specifying the repo source of the fixture you have a few options as to which revision of the codebase you wish to use, and optionally, the puppet versions where the fixture is needed.
195
195
 
196
196
  * repo - the url to the repo
197
197
  * scm - options include git or hg. This is an optional step as the helper code will figure out which scm is used.
@@ -215,6 +215,11 @@ When specifying the repo source of the fixture you have a few options as to whic
215
215
  ```yaml
216
216
  flags: --verbose
217
217
  ```
218
+ * puppet_version - versions of puppet for which the fixture should be installed. Ruby version constraints are supported. Only works when the `semantic_puppet` gem is available (shipped with puppet 4.0 and up, by default).
219
+
220
+ ```yaml
221
+ puppet_version: '>= 6.0.0'
222
+ ```
218
223
 
219
224
  **Note:** ref and branch can be used together to get a specific revision on a specific branch
220
225
 
@@ -263,6 +268,16 @@ fixtures:
263
268
  ref: "2.6.0"
264
269
  ```
265
270
 
271
+ Only install the `yumrepo_core` module when testing against Puppet 6 or greater:
272
+
273
+ ```yaml
274
+ fixtures:
275
+ repositories:
276
+ yumrepo_core:
277
+ repo: "git://github.com/puppetlabs/puppetlabs-yumrepo_core"
278
+ puppet_version: ">= 6.0.0"
279
+ ```
280
+
266
281
  Move manifests and siblings to root directory when they are inside a `code` directory:
267
282
 
268
283
  ```yaml
@@ -461,7 +476,7 @@ context.stubs(:some_method).with(arguments).returns('value')
461
476
  ```
462
477
  to this:
463
478
  ```
464
- allow(context).to receive(:some_method).with(arguments).and_returns('value')
479
+ allow(context).to receive(:some_method).with(arguments).and_return('value')
465
480
  ```
466
481
 
467
482
  Translate all expectations:
@@ -470,7 +485,7 @@ context.expects(:some_method).with(arguments).returns('value')
470
485
  ```
471
486
  to this:
472
487
  ```
473
- expect(context).to receive(:some_method).with(arguments).and_returns('value')
488
+ expect(context).to receive(:some_method).with(arguments).and_return('value')
474
489
  ```
475
490
 
476
491
  Rationale
@@ -84,6 +84,8 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
84
84
  # final option list
85
85
  opts = defaults.merge(opts)
86
86
 
87
+ next unless include_repo?(opts['puppet_version'])
88
+
87
89
  real_target = eval('"' + opts['target'] + '"')
88
90
  real_source = eval('"' + opts['repo'] + '"')
89
91
 
@@ -100,6 +102,18 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
100
102
  result
101
103
  end
102
104
 
105
+ def include_repo?(version_range)
106
+ if version_range && defined?(SemanticPuppet)
107
+ puppet_spec = Gem::Specification.find_by_name('puppet')
108
+ puppet_version = SemanticPuppet::Version.parse(puppet_spec.version.to_s)
109
+
110
+ constraint = SemanticPuppet::VersionRange.parse(version_range)
111
+ constraint.include?(puppet_version)
112
+ else
113
+ true
114
+ end
115
+ end
116
+
103
117
  def clone_repo(scm, remote, target, _subdir = nil, ref = nil, branch = nil, flags = nil)
104
118
  args = []
105
119
  case scm
@@ -1,5 +1,5 @@
1
1
  module PuppetlabsSpecHelper
2
- VERSION = '2.10.0'.freeze
2
+ VERSION = '2.11.0'.freeze
3
3
 
4
4
  # compat for pre-1.2.0 users; deprecated
5
5
  module Version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetlabs_spec_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-08-30 00:00:00.000000000 Z
12
+ date: 2018-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  version: '0'
221
221
  requirements: []
222
222
  rubyforge_project:
223
- rubygems_version: 2.5.1
223
+ rubygems_version: 2.7.6
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Standard tasks and configuration for module spec tests.