puppetlabs_spec_helper 2.0.2 → 2.1.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/CHANGELOG.md +10 -0
- data/README.md +40 -11
- data/lib/puppetlabs_spec_helper/rake_tasks.rb +18 -13
- data/lib/puppetlabs_spec_helper/version.rb +1 -1
- 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: 01f28b4872910d69e3d37d10e0a5e25193bd23b6
|
4
|
+
data.tar.gz: 9a2a2907b2bfc41da33c7fbd507a8dba3c361ca4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e4718a4d21f670b4d2c60bfb05becc6696e9e8ea3bfd4496cb1ae493ce449da24db54b0f2784026a27d4e67beb13b9e7441fb08e3303db910c2ad3f1acdc755
|
7
|
+
data.tar.gz: b8b98e85acfd1d6789b249409ebb6f799fe6631ac14192ce63f1660ae0f8f64f9d0cf05f11f95b73b6d65f9a289248069ebe3194a60a3d7fdd5e59b4aff7d22d
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [2.1.0]
|
6
|
+
### Summary:
|
7
|
+
Minor version bump for new CI_SPEC_OPTIONS variable and bug fix.
|
8
|
+
|
9
|
+
### Added:
|
10
|
+
- use CI_SPEC_OPTIONS to pass options to rspec
|
11
|
+
|
12
|
+
### Fixed:
|
13
|
+
- an issue where gettext:setup tasks were being loaded in the wrong order within a module and causing the POT file to be created in the Puppet gem, not the module.
|
14
|
+
|
5
15
|
## [2.0.2]
|
6
16
|
### Summary:
|
7
17
|
Fixes an issue where the gettext rake tasks look in the spec\_helper and not the current module for the `locales/` directory.
|
data/README.md
CHANGED
@@ -167,17 +167,6 @@ and manifest ordering, you would:
|
|
167
167
|
|
168
168
|
FUTURE_PARSER=yes STRICT_VARIABLES=yes ORDERING=manifest rake spec
|
169
169
|
|
170
|
-
When executing tests in a matrix CI environment, tests can be split up to run
|
171
|
-
a share of specs per CI node in parallel. Set the ``CI_NODE_TOTAL`` environment
|
172
|
-
variable to the total number of nodes, and the ``CI_NODE_INDEX`` to a number
|
173
|
-
between 1 and the ``CI_NODE_TOTAL``.
|
174
|
-
|
175
|
-
If using Travis CI, add new lines to the "env" section of .travis.yml per node,
|
176
|
-
remembering to duplicate any existing environment variables:
|
177
|
-
|
178
|
-
env:
|
179
|
-
- FUTURE_PARSER=yes CI_NODE_TOTAL=2 CI_NODE_INDEX=1
|
180
|
-
- FUTURE_PARSER=yes CI_NODE_TOTAL=2 CI_NODE_INDEX=2
|
181
170
|
|
182
171
|
Using Utility Classes
|
183
172
|
=====================
|
@@ -305,6 +294,46 @@ Testing Parser Functions
|
|
305
294
|
This whole section is superseded by improved support of accessing the scope in
|
306
295
|
rspec-puppet.
|
307
296
|
|
297
|
+
|
298
|
+
Modify rspec behavior
|
299
|
+
================================
|
300
|
+
|
301
|
+
#### Running Rspec with additional settings
|
302
|
+
|
303
|
+
You can add command line options to rspec using the `CI_SPEC_OPTIONS` environment variable. Any text in the `CI_SPEC_OPTIONS` environment variable is added as an rspec option. For example:
|
304
|
+
|
305
|
+
If you wanted to output JUnit test reports for a Jenkins CI server you could use;
|
306
|
+
|
307
|
+
Bash
|
308
|
+
``` bash
|
309
|
+
export CI_SPEC_OPTIONS = "-r yarjuf -f JUnit -o result.xml"
|
310
|
+
```
|
311
|
+
|
312
|
+
PowerShell
|
313
|
+
``` bash
|
314
|
+
$ENV:CI_SPEC_OPTIONS = '-r yarjuf -f JUnit -o result.xml'
|
315
|
+
```
|
316
|
+
|
317
|
+
And then run
|
318
|
+
```
|
319
|
+
bundle exec rake spec
|
320
|
+
```
|
321
|
+
|
322
|
+
This would cause rspec to load the `yarjuf` gem and output the results in JUnit format to the file `result.xml`
|
323
|
+
|
324
|
+
#### Running specs in parallel
|
325
|
+
When executing tests in a matrix CI environment, tests can be split up to run
|
326
|
+
a share of specs per CI node in parallel. Set the ``CI_NODE_TOTAL`` environment
|
327
|
+
variable to the total number of nodes, and the ``CI_NODE_INDEX`` to a number
|
328
|
+
between 1 and the ``CI_NODE_TOTAL``.
|
329
|
+
|
330
|
+
If using Travis CI, add new lines to the "env" section of .travis.yml per node,
|
331
|
+
remembering to duplicate any existing environment variables:
|
332
|
+
|
333
|
+
env:
|
334
|
+
- FUTURE_PARSER=yes CI_NODE_TOTAL=2 CI_NODE_INDEX=1
|
335
|
+
- FUTURE_PARSER=yes CI_NODE_TOTAL=2 CI_NODE_INDEX=2
|
336
|
+
|
308
337
|
Generating code coverage reports
|
309
338
|
================================
|
310
339
|
|
@@ -15,24 +15,13 @@ task :default => [:help]
|
|
15
15
|
|
16
16
|
pattern = 'spec/{aliases,classes,defines,unit,functions,hosts,integration,type_aliases,types}/**/*_spec.rb'
|
17
17
|
|
18
|
-
begin
|
19
|
-
spec = Gem::Specification.find_by_name 'gettext-setup'
|
20
|
-
load "#{spec.gem_dir}/lib/tasks/gettext.rake"
|
21
|
-
locales_dir = File.absolute_path('locales', Dir.pwd )
|
22
|
-
# Initialization requires a valid locales directory
|
23
|
-
if File.exist? locales_dir
|
24
|
-
GettextSetup.initialize(locales_dir)
|
25
|
-
else
|
26
|
-
puts "No 'locales' directory found in #{ Dir.pwd }, skipping gettext initialization" if Rake.verbose == true
|
27
|
-
end
|
28
|
-
rescue Gem::LoadError
|
29
|
-
puts "No gettext-setup gem found, skipping gettext initialization" if Rake.verbose == true
|
30
|
-
end
|
31
18
|
|
32
19
|
desc "Run spec tests on an existing fixtures directory"
|
33
20
|
RSpec::Core::RakeTask.new(:spec_standalone) do |t|
|
34
21
|
t.rspec_opts = ['--color']
|
35
22
|
|
23
|
+
t.rspec_opts << ENV['CI_SPEC_OPTIONS'] unless ENV['CI_SPEC_OPTIONS'].nil?
|
24
|
+
|
36
25
|
if ENV['CI_NODE_TOTAL'] && ENV['CI_NODE_INDEX']
|
37
26
|
ci_total = ENV['CI_NODE_TOTAL'].to_i
|
38
27
|
ci_index = ENV['CI_NODE_INDEX'].to_i
|
@@ -591,3 +580,19 @@ rescue LoadError
|
|
591
580
|
fail "rubocop is not available in this installation"
|
592
581
|
end
|
593
582
|
end
|
583
|
+
|
584
|
+
module_dir = Dir.pwd
|
585
|
+
locales_dir = File.absolute_path('locales', module_dir )
|
586
|
+
# if the task is allowed to run when the module does not have a locales directory,
|
587
|
+
# the task is run in the puppet gem instead and creates a POT there.
|
588
|
+
puts "gettext-setup tasks will only be loaded if the locales/ directory is present" if Rake.verbose == true
|
589
|
+
if File.exist? locales_dir
|
590
|
+
begin
|
591
|
+
spec = Gem::Specification.find_by_name 'gettext-setup'
|
592
|
+
load "#{spec.gem_dir}/lib/tasks/gettext.rake"
|
593
|
+
# Initialization requires a valid locales directory
|
594
|
+
GettextSetup.initialize(locales_dir)
|
595
|
+
rescue Gem::LoadError
|
596
|
+
puts "No gettext-setup gem found, skipping gettext initialization" if Rake.verbose == true
|
597
|
+
end
|
598
|
+
end
|
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.0
|
4
|
+
version: 2.1.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: 2017-
|
12
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mocha
|