puppetlabs_spec_helper 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWQxN2I3ZjM0MWZhYWQ4NTVhZGExNDAzMDA4OGU5NDg1M2QyZWJhOQ==
5
+ data.tar.gz: !binary |-
6
+ ZGExZjlmZTlmYTNlNTdkYzY0OTlhNzIyNDRmZGE1OTZhOGZlMjY0Mg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NjhjZmE1YjQxZTkxZTQ5NzE4NzkwYzBhMDNjMDA2YjUyNjJkNjZiZTI0NjA1
10
+ MTc5NzY3NDA3YmQ1MjllYjUzNDc4MzYwOGQ4Mjc4MjFkNDEyMzM0NmQ5OWJi
11
+ NDkxNDcxZWMxNTFjNmE3ODQwMTI5OWIzNTQ3MWVhNTgyODJkODY=
12
+ data.tar.gz: !binary |-
13
+ N2JiNmY2ZGQ3MWRhMmVmMzcxZjg2YmNjN2FiZTk3ZmZkZGY2NDVkOWY2Mzk2
14
+ N2RmOGM1YWRjMmU4ZmQxNjZjZGQ0ODhlMjM1MTRjN2E0NWI5ZmFjNDVlZDdl
15
+ ZDZhZDc0MjE2YTE1OGMxYjQyZWY2ZTk2YmZjM2Q1MWZiNzhmMmE=
data/CHANGELOG CHANGED
@@ -1,3 +1,17 @@
1
+ 2015-02-24 - Release 0.9.0
2
+ Summary:
3
+ This release adds fixes for rspec-puppet 2.0 and json linting for metadata.json
4
+
5
+ Features:
6
+ - Add json linting for metadata.json (adds dep on metadata-json-lint gem)
7
+ - Document using references in fixtures
8
+
9
+ Bugfixes:
10
+ - FUTURE_PARSER=yes working with rspec-puppet 2.0
11
+ - Symlinks breaking on windows
12
+ - rspec as a runtime dependency conflicting with rspec-puppet
13
+ - root stub for testing execs
14
+
1
15
  2014-10-01 - Release 0.8.2
2
16
  Summary:
3
17
  This release fixes the lint task on the latest puppet-lint
@@ -142,6 +142,24 @@ Using Fixtures
142
142
  `rake spec_prep` is run. To do so, all required modules should be listed in a
143
143
  file named `.fixtures.yml` in the root of the project.
144
144
 
145
+ When specifying the repo source of the fixture you have a few options as to which revision of the codebase you wish to use.
146
+
147
+ * repo - the url to the repo
148
+ * scm - options include git or hg. This is an optional step as the helper code will figure out which scm is used.
149
+ ```yaml
150
+ scm: git
151
+ scm: hg
152
+ ```
153
+ * target - the directory name to clone the repo into ie. `target: mymodule` defaults to the repo name (Optional)
154
+ * ref - used to specify the tag name like version hash of commit (Optional)
155
+ ```yaml
156
+ ref: 1.0.0
157
+ ref: 880fca52c
158
+ ```
159
+ * branch - used to specify the branch name you want to use ie. `branch: development`
160
+
161
+ **Note:** ref and branch can be used together to get a specific revision on a specific branch
162
+
145
163
  Fixtures Examples
146
164
  -----------------
147
165
  Basic fixtures that will symlink `spec/fixtures/modules/my_modules` to the
@@ -21,8 +21,8 @@ module_path = [module_path, env_module_path].join(File::PATH_SEPARATOR) if env_m
21
21
  RSpec.configure do |c|
22
22
  c.module_path = module_path
23
23
  c.manifest_dir = File.join(fixture_path, 'manifests')
24
- ## These depend on rspec-puppet #209 and #183 being released
25
- #c.parser = 'future' if ENV['FUTURE_PARSER'] == 'yes'
24
+ c.parser = 'future' if ENV['FUTURE_PARSER'] == 'yes'
25
+ ## This depends on rspec-puppet #209 being released
26
26
  #c.strict_variables = true if ENV['STRICT_VARIABLES'] == 'yes'
27
27
  ## These depend on rspec-puppet #212 being released
28
28
  #c.stringify_facts = false if ENV['STRINGIFY_FACTS'] == 'no'
@@ -30,8 +30,8 @@ RSpec.configure do |c|
30
30
  #c.ordering = ENV['ORDERING'] if ENV['ORDERING']
31
31
 
32
32
  c.before :each do
33
+ Puppet.features.stubs(:root?).returns(true)
33
34
  Puppet.settings[:strict_variables] = true if ENV['STRICT_VARIABLES'] == 'yes'
34
- Puppet.settings[:parser] = 'future' if ENV['FUTURE_PARSER'] == 'yes'
35
35
  Puppet.settings[:stringify_facts] = false if ENV['STRINGIFY_FACTS'] == 'no'
36
36
  Puppet.settings[:trusted_node_data] = true if ENV['TRUSTED_NODE_DATA'] == 'yes'
37
37
  Puppet.settings[:ordering] = ENV['ORDERING'] if ENV['ORDERING']
@@ -88,6 +88,17 @@ end
88
88
 
89
89
  desc "Create the fixtures directory"
90
90
  task :spec_prep do
91
+ # Ruby only sets File::ALT_SEPARATOR on Windows and Rubys standard library
92
+ # uses this to check for Windows
93
+ is_windows = !!File::ALT_SEPARATOR
94
+ puppet_symlink_available = false
95
+ begin
96
+ require 'puppet'
97
+ puppet_symlink_available = Puppet::FileSystem.respond_to?(:symlink)
98
+ rescue
99
+ end
100
+
101
+
91
102
  fixtures("repositories").each do |remote, opts|
92
103
  scm = 'git'
93
104
  if opts.instance_of?(String)
@@ -107,7 +118,12 @@ task :spec_prep do
107
118
 
108
119
  FileUtils::mkdir_p("spec/fixtures/modules")
109
120
  fixtures("symlinks").each do |source, target|
110
- File::exists?(target) || FileUtils::ln_sf(source, target)
121
+ if is_windows
122
+ fail "Cannot symlink on Windows unless using at least Puppet 3.5" if !puppet_symlink_available
123
+ Puppet::FileSystem::exist?(target) || Puppet::FileSystem::symlink(source, target)
124
+ else
125
+ File::exists?(target) || FileUtils::ln_sf(source, target)
126
+ end
111
127
  end
112
128
 
113
129
  fixtures("forge_modules").each do |remote, opts|
@@ -208,13 +224,19 @@ PuppetSyntax.exclude_paths ||= []
208
224
  PuppetSyntax.exclude_paths << "spec/fixtures/**/*.pp"
209
225
  PuppetSyntax.future_parser = true if ENV['FUTURE_PARSER'] == 'yes'
210
226
 
211
- desc "Check syntax of Ruby files and call :syntax"
227
+ desc "Check syntax of Ruby files and call :syntax and :metadata"
212
228
  task :validate do
213
229
  Dir['lib/**/*.rb'].each do |lib_file|
214
230
  sh "ruby -c #{lib_file}"
215
231
  end
216
232
 
217
233
  Rake::Task[:syntax].invoke
234
+ Rake::Task[:metadata].invoke if File.exist?('metadata.json')
235
+ end
236
+
237
+ desc "Validate metadata.json file"
238
+ task :metadata do
239
+ sh "metadata-json-lint metadata.json"
218
240
  end
219
241
 
220
242
  desc "Display the list of available rake tasks"
@@ -1,5 +1,5 @@
1
1
  module PuppetlabsSpecHelper
2
2
  module Version
3
- STRING = '0.8.2'
3
+ STRING = '0.9.0'
4
4
  end
5
5
  end
@@ -21,6 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.add_runtime_dependency 'rspec-puppet'
22
22
  s.add_runtime_dependency 'puppet-lint'
23
23
  s.add_runtime_dependency 'puppet-syntax'
24
- s.add_runtime_dependency 'rspec'
24
+ s.add_runtime_dependency 'metadata-json-lint'
25
25
  s.add_runtime_dependency 'mocha'
26
26
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetlabs_spec_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
5
- prerelease:
4
+ version: 0.9.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Puppet Labs
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-10-01 00:00:00.000000000 Z
11
+ date: 2015-02-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec-puppet
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: puppet-lint
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: puppet-syntax
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,15 +62,13 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
- name: rspec
70
+ name: metadata-json-lint
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: mocha
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -141,36 +128,30 @@ files:
141
128
  homepage: http://github.com/puppetlabs/puppetlabs_spec_helper
142
129
  licenses:
143
130
  - Apache-2.0
131
+ metadata: {}
144
132
  post_install_message:
145
133
  rdoc_options: []
146
134
  require_paths:
147
135
  - lib
148
136
  required_ruby_version: !ruby/object:Gem::Requirement
149
- none: false
150
137
  requirements:
151
138
  - - ! '>='
152
139
  - !ruby/object:Gem::Version
153
140
  version: '0'
154
- segments:
155
- - 0
156
- hash: -3854310657550255365
157
141
  required_rubygems_version: !ruby/object:Gem::Requirement
158
- none: false
159
142
  requirements:
160
143
  - - ! '>='
161
144
  - !ruby/object:Gem::Version
162
145
  version: '0'
163
- segments:
164
- - 0
165
- hash: -3854310657550255365
166
146
  requirements: []
167
147
  rubyforge_project:
168
- rubygems_version: 1.8.23.2
148
+ rubygems_version: 2.4.5
169
149
  signing_key:
170
- specification_version: 3
150
+ specification_version: 4
171
151
  summary: Standard tasks and configuration for module spec tests
172
152
  test_files:
173
153
  - spec/lib/puppet/type/spechelper.rb
174
154
  - spec/unit/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals_spec.rb
175
155
  - spec/unit/spechelper_spec.rb
176
156
  - spec/watchr.rb
157
+ has_rdoc: