rspec-system-puppet 2.0.0 → 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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ 2.1.0
2
+ =====
3
+
4
+ This feature release provides some minor bug fixes, improved docuemntation and features as outlined below.
5
+
6
+ #### Detailed Changes
7
+
8
+ * Remove coupling with Bundler (Hunter Haugen)
9
+ * Add module_path option to puppet_apply helper (Dominic Cleal)
10
+ * Pass node option when creating the host alias for puppet (Trey Dockendorf)
11
+
1
12
  2.0.0
2
13
  =====
3
14
 
data/README.md CHANGED
@@ -17,6 +17,8 @@ Recommended to be installed first:
17
17
  * VirtualBox 4.2.10 or greater
18
18
  * RVM or RBenv (current instructions are based on RVM however)
19
19
 
20
+ ### Create a nodeset file
21
+
20
22
  In your existing Puppet module project, create a `.nodeset.yml` with the following contents:
21
23
 
22
24
  ---
@@ -51,12 +53,21 @@ In your existing Puppet module project, create a `.nodeset.yml` with the followi
51
53
  "main.foo.vm":
52
54
  prefab: 'ubuntu-server-12042-x64'
53
55
 
54
- Make sure you have a `Gemfile` like the one below, this includes `rspec-puppet` test content as well:
56
+ ### Install the gem
57
+
58
+ The intention is that this gem is used within your project as a development library.
59
+
60
+ You may install `rspec-system-puppet` manually with:
61
+
62
+ # gem install rspec-system-puppet
63
+
64
+ However it is usually recommended to include `gem 'rspec-system-puppet'` in your `Gemfile` and let bundler install it. An example `Gemfile` is shown below. This includes `rspec-puppet` test content as well:
55
65
 
56
66
  source 'https://rubygems.org'
57
67
 
58
68
  group :development, :test do
59
69
  gem 'rake'
70
+ gem 'rspec-puppet'
60
71
  gem 'puppetlabs_spec_helper', :require => false
61
72
  gem 'rspec-system-puppet'
62
73
  gem 'puppet-lint'
@@ -68,14 +79,16 @@ Make sure you have a `Gemfile` like the one below, this includes `rspec-puppet`
68
79
  gem 'puppet', :require => false
69
80
  end
70
81
 
71
- Create a `Rakefile` like so:
82
+ Install using Bundler with:
72
83
 
73
- require 'rubygems'
74
- require 'bundler/setup'
84
+ bundle install --path vendor/bundle
75
85
 
76
- Bundler.require :default
86
+ If you're using git, add `.rspec_system` to your project's `.gitignore` file. This is the default location for files created by rspec-system.
87
+
88
+ ### Create rakefile
89
+
90
+ Create a `Rakefile` like so:
77
91
 
78
- require 'rspec/core/rake_task'
79
92
  require 'puppetlabs_spec_helper/rake_tasks'
80
93
  require 'rspec-system/rake_task'
81
94
 
@@ -83,6 +96,8 @@ Create a `Rakefile` like so:
83
96
  sh %{rake -T}
84
97
  end
85
98
 
99
+ ### Create spec helper
100
+
86
101
  You will need a spec helper for your tests to `require`. So create the file `spec/spec_helper_system.rb`:
87
102
 
88
103
  require 'rspec-system/spec_helper'
@@ -91,10 +106,10 @@ You will need a spec helper for your tests to `require`. So create the file `spe
91
106
  include RSpecSystemPuppet::Helpers
92
107
 
93
108
  RSpec.configure do |c|
94
- # Project root for the firewall code
109
+ # Project root
95
110
  proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
96
111
 
97
- # Enable colour in Jenkins
112
+ # Enable colour
98
113
  c.tty = true
99
114
 
100
115
  c.include RSpecSystemPuppet::Helpers
@@ -110,7 +125,9 @@ You will need a spec helper for your tests to `require`. So create the file `spe
110
125
  end
111
126
  end
112
127
 
113
- Now if you are using rspec-puppet, I advise you to seperate the location of your system and unit tests:
128
+ ### Create system spec tests
129
+
130
+ I advise you to seperate the location of your system and unit tests:
114
131
 
115
132
  * spec/system - system tests
116
133
  * spec/unit - rspec-puppet and other unit tests
@@ -132,7 +149,7 @@ And create your first system tests in say `spec/system/basic_spec.rb` (make sure
132
149
  pp = <<-EOS
133
150
  class { 'mymodule': }
134
151
  EOS
135
-
152
+
136
153
  # Run it twice and test for idempotency
137
154
  puppet_apply(pp) do |r|
138
155
  r.exit_code.should_not == 1
@@ -142,23 +159,17 @@ And create your first system tests in say `spec/system/basic_spec.rb` (make sure
142
159
  end
143
160
  end
144
161
 
145
- Now start by creating a gemset environment for your run:
162
+ ### Run spec tests
146
163
 
147
- # rvm --create --ruby-version use ruby-1.9.3@mymodule
148
-
149
- Then grab the gemset bundle:
164
+ Now you should be able to do:
150
165
 
151
- # bundle update
166
+ # bundle exec rake spec:system
152
167
 
153
- Now you should be able to do:
168
+ If you want to test an alternate set, just use the `RSPEC_SET` environment variable like so:
154
169
 
155
- # rake spec:system
156
-
157
- If you want to test an alternate set, just use the RSPEC_SET environment variable like so:
170
+ # RSPEC_SET=debian-70rc1-x64 bundle exec rake spec:system
158
171
 
159
- # RSPEC_SET=debian-70rc1-x64 rake spec:system
160
-
161
- Consult the .nodeset.yml file for the list of sets.
172
+ Consult the `.nodeset.yml` file for the list of sets.
162
173
 
163
174
  ## Further Information
164
175
 
data/Rakefile CHANGED
@@ -1,8 +1,3 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
-
4
- Bundler.require :default
5
-
6
1
  require 'rspec/core/rake_task'
7
2
  require 'rspec-system/rake_task'
8
3
 
@@ -91,6 +91,7 @@ module RSpecSystemPuppet::Helpers
91
91
  # @option opts [RSpecSystem::Node] :node node to execute DSL on
92
92
  # @option opts [Boolean] :debug true if debugging required
93
93
  # @option opts [Boolean] :trace true if trace required
94
+ # @option opts [String] :module_path puppet modulepath to use
94
95
  # @return [RSpecSystem::Helpers::PuppetApply] helper object
95
96
  # @yield [result] yields result when called as a block
96
97
  # @yieldparam result [RSpecSystemPuppet::Helpers::PuppetApply] helper object
@@ -41,6 +41,7 @@ module RSpecSystem::Helpers
41
41
  cmd = "puppet apply --detailed-exitcodes"
42
42
  cmd += " --debug" if opts[:debug]
43
43
  cmd += " --trace" if opts[:trace]
44
+ cmd += " --modulepath #{opts[:module_path]}" if opts[:module_path]
44
45
  cmd += " #{remote_path}"
45
46
 
46
47
  shell(:c => cmd, :n => node).to_hash
@@ -48,7 +48,7 @@ host { 'puppet':
48
48
  ip => '127.0.0.1',
49
49
  }
50
50
  EOS
51
- puppet_apply(pp)
51
+ puppet_apply :code => pp, :n => node
52
52
 
53
53
  # Create hiera.yaml
54
54
  file = Tempfile.new('hierayaml')
@@ -2,11 +2,12 @@
2
2
  Gem::Specification.new do |s|
3
3
  # Metadata
4
4
  s.name = "rspec-system-puppet"
5
- s.version = "2.0.0"
5
+ s.version = "2.1.0"
6
6
  s.authors = ["Ken Barber"]
7
- s.email = ["ken@bob.sh"]
7
+ s.email = ["info@puppetlabs.com"]
8
8
  s.homepage = "https://github.com/puppetlabs/rspec-system-puppet"
9
9
  s.summary = "Puppet rspec-system plugin"
10
+ s.license = "Apache 2.0"
10
11
 
11
12
  # Manifest
12
13
  s.files = `git ls-files`.split("\n")
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,6 @@
1
1
  dir = File.expand_path(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift File.join(dir, 'lib')
3
3
 
4
- require 'rubygems'
5
- require 'bundler/setup'
6
-
7
- Bundler.require :default, :test
8
-
9
4
  require 'pathname'
10
5
  require 'tmpdir'
11
6
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-system-puppet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 2.0.0
10
+ version: 2.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ken Barber
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-06-10 00:00:00 Z
18
+ date: 2013-08-13 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec-system
@@ -34,7 +34,7 @@ dependencies:
34
34
  version_requirements: *id001
35
35
  description:
36
36
  email:
37
- - ken@bob.sh
37
+ - info@puppetlabs.com
38
38
  executables: []
39
39
 
40
40
  extensions: []
@@ -70,8 +70,8 @@ files:
70
70
  - spec/system/puppet_module_install_spec.rb
71
71
  - spec/system/puppet_resource_spec.rb
72
72
  homepage: https://github.com/puppetlabs/rspec-system-puppet
73
- licenses: []
74
-
73
+ licenses:
74
+ - Apache 2.0
75
75
  post_install_message:
76
76
  rdoc_options: []
77
77
 
@@ -112,4 +112,3 @@ test_files:
112
112
  - spec/system/puppet_apply_spec.rb
113
113
  - spec/system/puppet_module_install_spec.rb
114
114
  - spec/system/puppet_resource_spec.rb
115
- has_rdoc: