cucumber-puppet 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :build:
3
- :patch: 2
3
+ :patch: 3
4
4
  :minor: 3
5
5
  :major: 0
@@ -64,7 +64,7 @@ class CucumberPuppet
64
64
  begin
65
65
  # Compile our catalog
66
66
  begin
67
- @catalog = Puppet::Resource::Catalog.find(node.name, :use_node => node)
67
+ @catalog = Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node)
68
68
  rescue NameError
69
69
  @catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)
70
70
  end
@@ -74,6 +74,8 @@ class CucumberPuppet
74
74
  end
75
75
  if detail.is_a?(XMLRPC::FaultException)
76
76
  $stderr.puts detail.message
77
+ elsif detail.is_a?(Puppet::Error)
78
+ raise Puppet::Error, detail.message
77
79
  else
78
80
  $stderr.puts detail
79
81
  end
@@ -12,7 +12,12 @@ Given /^I use storeconfigs$/ do
12
12
  end
13
13
 
14
14
  When /^I compile its catalog$/ do
15
- compile_catalog(@node)
15
+ @compile_error = false
16
+ begin
17
+ compile_catalog(@node)
18
+ rescue
19
+ @compile_error = true
20
+ end
16
21
  end
17
22
 
18
23
  Then /^all resource dependencies should resolve$/ do
@@ -2,14 +2,51 @@ Given /^a node of class "([^\"]*)"$/ do |klass|
2
2
  @klass = klass
3
3
  end
4
4
 
5
+ # And
6
+ Given /^of class "([^\"]*)"$/ do |klass|
7
+ # we expect this to only be used in conjunction with other classes
8
+ fail unless @klass
9
+
10
+ if @klass.is_a? String
11
+ # FIXME: Arrays currently unsupported
12
+ @klass = {@klass => nil, klass => nil}
13
+ elsif @klass.is_a? Hash
14
+ @klass = @klass.merge({klass => nil})
15
+ end
16
+ end
17
+
5
18
  Given /^a node of class "([^\"]*)" with parameters:$/ do |klass, params|
6
19
  parameters = {}
7
20
  params.hashes.each do |param|
8
- parameters[param['name']] = param['value']
21
+ if param['value'] == "true"
22
+ parameters[param['name']] = true
23
+ elsif param['value'] == "false"
24
+ parameters[param['name']] = false
25
+ else
26
+ parameters[param['name']] = param['value']
27
+ end
9
28
  end
10
29
  @klass = { klass => parameters }
11
30
  end
12
31
 
32
+ # And
33
+ Given /^of class "([^\"]*)" with parameters:$/ do |klass, params|
34
+ # we expect this to only be used in conjunction with other classes
35
+ fail unless @klass
36
+
37
+ parameters = {}
38
+ params.hashes.each do |param|
39
+ parameters[param['name']] = param['value']
40
+ end
41
+
42
+ if @klass.is_a? String
43
+ # FIXME: Arrays currently unsupported
44
+ @klass = {@klass => nil, klass => parameters}
45
+ elsif @klass.is_a? Hash
46
+ @klass = @klass.merge({klass => parameters})
47
+ end
48
+ end
49
+
13
50
  Given /^a node named "([^\"]*)"$/ do |name|
14
51
  @facts['hostname'] = name
15
52
  end
@@ -23,7 +60,16 @@ Given /^it is a virtual node$/ do
23
60
  end
24
61
 
25
62
  When /^I compile the catalog$/ do
26
- compile_catalog
63
+ @compile_error = false
64
+ begin
65
+ compile_catalog
66
+ rescue
67
+ @compile_error = true
68
+ end
69
+ end
70
+
71
+ Then /^compilation should fail$/ do
72
+ fail "Compilation was expected to fail but did not." unless @compile_error == true
27
73
  end
28
74
 
29
75
  Then /^the [a-z]* should have "([^\"]*)" set to "(false|true)"$/ do |res, bool|
@@ -35,7 +81,27 @@ Then /^the [a-z]* should have "([^\"]*)" set to "(false|true)"$/ do |res, bool|
35
81
  end
36
82
 
37
83
  Then /^the [a-z]* should have an? "([^\"]*)" of "([^\"]*)"$/ do |property, value|
38
- fail unless @resource[property] == value
84
+ value.gsub!('\n', "\n") # otherwise newlines don't get handled properly
85
+ if @resource[property].is_a?(Puppet::Resource)
86
+ prop = @resource[property].to_s
87
+ elsif @resource[property].kind_of?(Array)
88
+ if value =~ /, /
89
+ value = value.split(", ")
90
+ elsif value =~ /,/
91
+ value = value.split(",")
92
+ else
93
+ value = value.split
94
+ end
95
+
96
+ prop = @resource[property]
97
+ elsif @resource[property].is_a?(String)
98
+ prop = @resource[property]
99
+ else
100
+ fail "Class #{@resource[property].class} not supported. Please modify steps to accomodate."
101
+ end
102
+
103
+ fail "Resource #{@resource} had #{property}='#{@resource[property] ? @resource[property] : "<empty>"}', not '#{value}'" \
104
+ unless prop == value
39
105
  end
40
106
 
41
107
  Then /^the [a-z]* should notify "([^\"]*)"$/ do |res|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-puppet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nikolay Sturm
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-17 00:00:00 +02:00
19
- default_executable:
18
+ date: 2011-08-22 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: cucumber
@@ -96,7 +95,6 @@ files:
96
95
  - lib/generators/world/steps/service.rb
97
96
  - lib/generators/world/support/hooks.rb
98
97
  - lib/generators/world/support/world.rb
99
- has_rdoc: true
100
98
  homepage: http://projects.puppetlabs.com/projects/cucumber-puppet
101
99
  licenses: []
102
100
 
@@ -126,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
124
  requirements: []
127
125
 
128
126
  rubyforge_project:
129
- rubygems_version: 1.6.2
127
+ rubygems_version: 1.8.6
130
128
  signing_key:
131
129
  specification_version: 3
132
130
  summary: Puppet catalog testing with Cucumber