cucumber-chef 3.0.5 → 3.0.6

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.
@@ -72,11 +72,11 @@ module Cucumber
72
72
  ################################################################################
73
73
 
74
74
  def ip
75
- (Cucumber::Chef.lab_ip || super(:ip))
75
+ (Cucumber::Chef.lab_ip || @provider.ip)
76
76
  end
77
77
 
78
78
  def port
79
- (Cucumber::Chef.lab_ssh_port || super(:port))
79
+ (Cucumber::Chef.lab_ssh_port || @provider.port)
80
80
  end
81
81
 
82
82
  ################################################################################
@@ -12,8 +12,8 @@ When /^I have the following SSH sessions:$/ do |table|
12
12
  @ssh_sessions[id] = ZTK::SSH.new
13
13
 
14
14
  @ssh_sessions[id].config.proxy_host_name = $cc_client.test_lab.ip
15
- @ssh_sessions[id].config.proxy_user = Cucumber::Chef.lab_user
16
- @ssh_sessions[id].config.proxy_keys = Cucumber::Chef.lab_identity
15
+ @ssh_sessions[id].config.proxy_user = Cucumber::Chef.lab_user
16
+ @ssh_sessions[id].config.proxy_keys = Cucumber::Chef.lab_identity
17
17
 
18
18
  hash['hostname'] and (@ssh_sessions[id].config.host_name = hash['hostname'])
19
19
  hash['username'] and (@ssh_sessions[id].config.user = hash['username'])
@@ -33,9 +33,9 @@ When /^I ssh to "([^\"]*)" with the following credentials:$/ do |hostname, table
33
33
  @connection = ZTK::SSH.new(:timeout => 120, :ignore_exit_status => true)
34
34
 
35
35
  @connection.config.proxy_host_name = $cc_client.test_lab.ip
36
- @connection.config.proxy_port = $cc_client.test_lab.port
37
- @connection.config.proxy_user = Cucumber::Chef.lab_user
38
- @connection.config.proxy_keys = Cucumber::Chef.lab_identity
36
+ @connection.config.proxy_port = $cc_client.test_lab.port
37
+ @connection.config.proxy_user = Cucumber::Chef.lab_user
38
+ @connection.config.proxy_keys = Cucumber::Chef.lab_identity
39
39
 
40
40
  hostname and (@connection.config.host_name = hostname)
41
41
  session["password"] and (@connection.config.password = session["password"])
@@ -60,8 +60,8 @@ When /^I ssh to "([^\"]*)" with the following credentials:$/ do |hostname, table
60
60
  end
61
61
 
62
62
  And /^I run "([^\"]*)"$/ do |command|
63
- @result = @connection.exec(command, :silence => true)
64
- @output = @result.output
63
+ @result = @connection.exec(command, :silence => true)
64
+ @output = @result.output
65
65
  @exit_code = @result.exit_code
66
66
  end
67
67
 
@@ -85,53 +85,59 @@ Then /^the exit code should be "([^\"]*)"$/ do |exit_code|
85
85
  @exit_code.to_i.should == exit_code.to_i
86
86
  end
87
87
 
88
- Then /^(path|directory|file|symlink) "([^\"]*)" should exist$/ do |type, path|
89
- parent = File.dirname path
90
- child = File.basename path
91
- command = "ls %s" % [
92
- parent
88
+ Then /^(path|directory|file|symlink) "([^\"]*)" should( not)? exist$/ do |type, path, boolean|
89
+ parent = File.dirname path
90
+ child = File.basename path
91
+ command = "ls -a %s" % [
92
+ parent
93
93
  ]
94
94
  @output = @connection.exec(command, :silence => true).output
95
- @output.should =~ /#{child}/
95
+ if (!boolean)
96
+ @output.should =~ /#{child}/
97
+ else
98
+ @output.should_not =~ /#{child}/
99
+ end
96
100
 
97
101
  # if a specific type (directory|file) was specified, test for it
98
102
  command = "stat -c %%F %s" % [
99
- path
103
+ path
100
104
  ]
101
105
  @output = @connection.exec(command, :silence => true).output
102
- types = {
103
- "file" => /regular file/,
104
- "directory" => /directory/,
105
- "symlink" => /symbolic link/
106
+ types = {
107
+ "file" => /regular file/,
108
+ "directory" => /directory/,
109
+ "symlink" => /symbolic link/
106
110
  }
107
111
 
108
112
  if types.keys.include? type
109
- @output.should =~ types[type]
113
+ if (!boolean)
114
+ @output.should =~ types[type]
115
+ end
110
116
  end
111
117
  end
112
118
 
113
119
  Then /^(?:path|directory|file) "([^\"]*)" should be owned by "([^\"]*)"$/ do |path, owner|
114
120
  command = "stat -c %%U:%%G %s" % [
115
- path
121
+ path
116
122
  ]
117
- @output = @connection.exec(command).output
123
+ @output = @connection.exec(command, :silence => true).output
118
124
  @output.should =~ /#{owner}/
119
125
  end
120
126
 
121
127
  # we can now match multi-line strings. We want to match *contiguous lines*
122
128
  Then /^file "([^\"]*)" should( not)? contain/ do |path, boolean, content|
123
129
  command = "cat %s" % [
124
- path
130
+ path
125
131
  ]
126
132
 
127
133
  # turn the command-line output and the expectation string into Arrays and strip
128
134
  # leading and trailing cruft from members
129
- @output = @connection.exec(command).output.split("\n").map{ |i| i.strip }
130
- content = content.split("\n").map{ |i| i.strip }
135
+ @output = @connection.exec(command, :silence => true).output.split("\n").map { |i| i.strip }
136
+ content = content.split("\n").map { |i| i.strip }
131
137
 
132
138
  # assume no match
133
- match = false
134
- count = 0
139
+ match = false
140
+ count = 0
135
141
 
136
142
  # step through the command output array
137
143
  while count < @output.length
@@ -172,6 +178,12 @@ Then /^package "([^\"]*)" should be installed$/ do |package|
172
178
  @result.output.should =~ /#{package}/
173
179
  end
174
180
 
181
+ Then /^"mod_([^ ]*)" should be enabled$/ do |mod|
182
+ command = "apache2ctl -t -D DUMP_MODULES"
183
+ @result = @connection.exec(command, :silence => true)
184
+ @result.output.should =~ /#{mod}_module/
185
+ end
186
+
175
187
  # This regex is a little ugly, but it's so we can accept any of these
176
188
  #
177
189
  # * "foo" is running
@@ -186,7 +198,7 @@ end
186
198
  # works
187
199
  Then /^(?:(?:service|application|process)? )?"([^\"]*)" should( not)? be running$/ do |service, boolean|
188
200
  command = "ps ax"
189
- @output = @connection.exec(command).output
201
+ @output = @connection.exec(command, :silence => true).output
190
202
  if (!boolean)
191
203
  @output.should =~ /#{service}/
192
204
  else
@@ -24,7 +24,7 @@ module Cucumber
24
24
 
25
25
  ################################################################################
26
26
 
27
- VERSION = "3.0.5" unless const_defined?(:VERSION)
27
+ VERSION = "3.0.6" unless const_defined?(:VERSION)
28
28
 
29
29
  ################################################################################
30
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-04-08 00:00:00.000000000 Z
13
+ date: 2013-04-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fog