aruba-jbb 0.2.6.11 → 0.2.6.12

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -11,13 +11,14 @@ tmtags
11
11
  .\#*
12
12
 
13
13
  ## VIM
14
- *.swp
14
+ *swp
15
+ *swpo
15
16
 
16
17
  ## PROJECT::GENERAL
17
- *.gem
18
18
  coverage
19
- rdoc
19
+ *gem
20
20
  pkg
21
+ rdoc
21
22
 
22
23
  ## PROJECT::SPECIFIC
23
24
  tmp
data/Gemfile CHANGED
@@ -2,9 +2,9 @@ source "http://rubygems.org"
2
2
  gemspec
3
3
 
4
4
  # Use source from sibling folders (if available) instead of gems
5
- %w[cucumber].each do |g|
6
- if File.directory?(File.dirname(__FILE__) + "/../#{g}")
7
- @dependencies.reject!{|dep| dep.name == g}
8
- gem g, :path => "../#{g}"
9
- end
10
- end
5
+ # %w[cucumber].each do |g|
6
+ # if File.directory?(File.dirname(__FILE__) + "/../#{g}")
7
+ # @dependencies.reject!{|dep| dep.name == g}
8
+ # gem g, :path => "../#{g}"
9
+ # end
10
+ # end
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.2.6.12 jbb
2
+ * merged aslak 0.2.4
3
+ * added remove_env to api
4
+ * update api documentation
5
+ * revised run steps
6
+
7
+
1
8
  == 0.2.6.11 jbb
2
9
  * administrative fix to gemspec data and dependencies
3
10
  * added NO_ARUBA_STEPS env var to not load aruba/cucumber_steps.rb library (exp)
@@ -51,9 +58,16 @@
51
58
  * Expanded directory and file detection self-test cross-check. (JBB)
52
59
 
53
60
 
61
+ == 0.2.4
62
+
63
+ === New Features
64
+ * Added step definitions for removing files and checking presence of a single file. (Aslak Hellesøy)
65
+
66
+
54
67
  == 0.2.3 jbb
55
68
  * Fixed no directories step error and added scenario to test this
56
69
 
70
+
57
71
  == 0.2.3 aslak
58
72
 
59
73
  === Bug fixes
@@ -72,6 +86,7 @@
72
86
  * Forked from Aruba 0.2.1 and renamed to aruba-jbb (JBB)
73
87
  * Removed unnecessary dependencies on cucumber and rspec beta versions. (JBB)
74
88
 
89
+
75
90
  == 0.2.2 aslak
76
91
 
77
92
  === New Features
data/aruba-jbb.gemspec CHANGED
@@ -2,20 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{aruba-jbb}
5
- s.version = "0.2.6.11"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
5
+ s.version = "0.2.6.12"
8
6
  s.authors = ["Aslak Hellesøy", "David Chelimsky", "James B. Byrne", "Mike Sassak"]
9
- s.date = %q{2010-10-26}
7
+ s.date = %q{2010-11-04}
10
8
  s.description = %q{Fork of Aruba, Cucumber steps for testing CLI applications.}
11
9
  s.email = %q{cukes@googlegroups.com}
12
10
  s.homepage = %q{http://github.com/byrnejb/aruba}
13
11
  s.rdoc_options = ["--charset=UTF-8"]
14
12
  s.summary = %q{Cucumber steps for testing external processes from the CLI}
15
13
 
16
- s.add_dependency 'cucumber', '~> 0.9.0'
14
+ s.add_dependency 'cucumber', '~> 0.9.3'
17
15
  s.add_dependency 'background_process' # Can't specify a version - bundler/rubygems chokes on '2.1'
18
- s.add_development_dependency 'rspec', '~> 2.0.0'
16
+ s.add_development_dependency 'rspec', '~> 2.0.1'
19
17
 
20
18
  s.rubygems_version = "1.3.7"
21
19
  s.files = `git ls-files`.split("\n")
@@ -122,6 +122,7 @@ Feature: file system commands
122
122
  HELLO WORLD
123
123
  """
124
124
 
125
+
125
126
  Scenario: @aruba-tmpdir flag runs scenario in tmp/aruba
126
127
  When I run "ruby -e \"require 'fileutils'; puts FileUtils.pwd\""
127
128
  Then the stdout should contain "tmp/aruba"
@@ -152,8 +153,8 @@ Feature: file system commands
152
153
  And I delete the cwd sub-directory named "rebase_test"
153
154
 
154
155
 
155
- Scenario: Check file contents with regex
156
- Given we do have a file named "foo" with:
156
+ Scenario: Check file contents with regexp
157
+ Given I do have a file named "foo" with:
157
158
  """
158
159
  hello world
159
160
  """
@@ -161,3 +162,10 @@ Feature: file system commands
161
162
  And the file "foo" should not match /HELLO WORLD/
162
163
 
163
164
 
165
+ Scenario: Remove file
166
+ Given I do have a file named "foo" with:
167
+ """
168
+ hello world
169
+ """
170
+ When I remove the file "foo"
171
+ Then the file "foo" should not exist
@@ -1,3 +1,4 @@
1
+ @timeout
1
2
  Feature: process should timeout
2
3
 
3
4
  In order to prevent test runs from suspending indefinitiely
@@ -0,0 +1,17 @@
1
+ Feature: run command should not limit size of STDOUT
2
+
3
+ In order to specify commands that produce output to STDOUT
4
+ As a developer using Cucumber
5
+ I want all output in STDOUT to display
6
+
7
+ @wip @announce
8
+ Scenario: Handle a large STDOUT data stream
9
+ #When I run "ruby -e \" 500.times.each { |i| puts %Q(rword #{i+1} ) * 6 }\""
10
+ #When I run "ruby -e \" 1000.times { puts %Q(rword ) * 12 }\""
11
+ #Then the stdout should contain "rword"
12
+ When I run "ruby -e 'puts :a.to_s * 65535'"
13
+ Then the stdout should contain "aaaaa"
14
+ When I run "ruby -e 'puts :b.to_s * 65536'"
15
+ Then the stdout should contain "bbbbb"
16
+ When I run "ruby -e 'puts :c.to_s * 65537'"
17
+ Then the stdout should contain "ccccc"
data/lib/aruba/api.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'timeout'
2
- require 'tempfile'
3
2
  require 'rbconfig'
3
+ require 'fileutils'
4
4
  require 'background_process'
5
5
 
6
6
  module Aruba
@@ -181,6 +181,7 @@ module Aruba
181
181
  end
182
182
  end
183
183
 
184
+
184
185
  # check_exact_file_content veries that the specified file contains
185
186
  # exactly the provided text.
186
187
  #
@@ -489,7 +490,8 @@ module Aruba
489
490
  end
490
491
 
491
492
  # original_env is an internal helper method that returns a hash of the
492
- # original env variables and their values for use in restore_original_env
493
+ # env variables and their values. See: remove_env(), restore_env() and
494
+ # set_env().
493
495
  #
494
496
  def original_env
495
497
  @original_env ||= {}
@@ -567,8 +569,29 @@ module Aruba
567
569
  Regexp === string_or_regexp ? string_or_regexp : Regexp.compile(Regexp.escape(string_or_regexp))
568
570
  end
569
571
 
570
- # restore_env is an internal helper method that restors the user's original
571
- # environment at the completion of a scenario using Aruba.
572
+
573
+ # remove_env removes (unsets) the given environmental variable from
574
+ # the original working environment. See restore_env() and set_env()
575
+ #
576
+ # Usage:
577
+ # When /(?:delete|unset) the env variable "([^\"]*)"$/ do |var|
578
+ # remove_env(var)
579
+ # end
580
+ #
581
+ def remove_env(key)
582
+ original_env[key] = ENV.delete(key)
583
+ end
584
+
585
+ # remove file implements the rm command and removes the file whose name
586
+ # is given as the argument.
587
+ def remove_file(file_name)
588
+ in_current_dir do
589
+ FileUtils.rm(file_name)
590
+ end
591
+ end
592
+
593
+ # restore_env method restores the user's original environment at the
594
+ # completion of a scenario using Aruba. See set_env().
572
595
  #
573
596
  def restore_env
574
597
  original_env.each do |key, value|
@@ -660,12 +683,17 @@ module Aruba
660
683
  end
661
684
  end
662
685
 
663
- # set_env(key, value) is an internal helper method that sets a hash of the
664
- # original env variables and their values for restore_original_env
686
+ # set_env method permits setting of environment variables for aruba
687
+ # run commands. See restore_env() and remove_env().
665
688
  #
689
+ # Usage:
690
+ # When /(?:add|set) the env variable "([^\"]*)" to "(.*)"$/ do |var, val|
691
+ # set_env(var, val)
692
+ # end
693
+ #
666
694
  def set_env(key, value)
667
695
  announce_or_puts(%{$ export #{key}="#{value}"}) if @announce_env
668
- original_env[key] = ENV.delete(key)
696
+ remove_env(key)
669
697
  ENV[key] = value
670
698
  end
671
699
 
@@ -83,6 +83,10 @@ When /^I append to "([^\"]*)" with:$/ do |file_name, file_content|
83
83
  append_to_file(file_name, file_content)
84
84
  end
85
85
 
86
+ When /^I remove the file "([^\"]*)"$/ do |file_name|
87
+ remove_file(file_name)
88
+ end
89
+
86
90
  When /^I cd to "([^\"]*)"$/ do |dir|
87
91
  cd(dir)
88
92
  end
@@ -176,6 +180,10 @@ Then /^the stdout should not contain "([^\"]*)"$/ do |partial_output|
176
180
  @last_stdout.should_not =~ regexp(partial_output)
177
181
  end
178
182
 
183
+ Then /^the file "([^\"]*)" should not exist$/ do |file_name|
184
+ check_file_presence([file_name], false)
185
+ end
186
+
179
187
  Then /^the following files should exist:$/ do |files|
180
188
  check_file_presence(files.raw.map{|file_row| file_row[0]}, true)
181
189
  end
@@ -2,6 +2,25 @@ require 'aruba/api'
2
2
 
3
3
  World(Aruba::Api)
4
4
 
5
+ Before('@disable-bundler') do
6
+ unset_bundler_env_vars
7
+ end
8
+
9
+ Before do
10
+ @__aruba_original_paths = (ENV['PATH'] || '').split(File::PATH_SEPARATOR)
11
+ ENV['PATH'] = ([File.expand_path('bin')] +
12
+ @__aruba_original_paths).join(File::PATH_SEPARATOR)
13
+ end
14
+
15
+ After do
16
+ ENV['PATH'] = @__aruba_original_paths.join(File::PATH_SEPARATOR)
17
+ end
18
+
19
+
20
+ Before do
21
+ #FileUtils.rm_rf(current_dir)
22
+ end
23
+
5
24
 
6
25
  Before do
7
26
  aruba_working_dir_init
@@ -24,6 +43,16 @@ Before('@announce-cmd') do
24
43
  end
25
44
 
26
45
 
46
+ Before('@announce-dir') do
47
+ @announce_dir = true
48
+ end
49
+
50
+
51
+ Before('@announce-env') do
52
+ @announce_env = true
53
+ end
54
+
55
+
27
56
  Before('@announce-stdout') do
28
57
  @announce_stdout = true
29
58
  end
@@ -37,16 +66,33 @@ end
37
66
  Before('@announce') do
38
67
  @announce_stdout = true
39
68
  @announce_stderr = true
69
+ @announce_env = true
70
+ @announce_dir = true
40
71
  @announce_cmd = true
41
72
  end
42
73
 
43
74
 
44
- When /append to "([^\"]*)" with:$/ do |file_name, file_content|
75
+ Before('@puts') do
76
+ @puts = true
77
+ end
78
+
79
+
80
+ After do
81
+ restore_env
82
+ end
83
+
84
+
85
+ When /(?:add|set) the env variable "([^\"]*)" to "(.*)"/ do |var, val|
86
+ set_env(var, val)
87
+ end
88
+
89
+
90
+ When /appends? to "([^\"]*)" with:$/ do |file_name, file_content|
45
91
  append_to_file(file_name, file_content)
46
92
  end
47
93
 
48
94
 
49
- When /cd to "([^\"]*)"$/ do |dir|
95
+ When /(?:cds?|chdirs?) to "([^\"]*)"$/ do |dir|
50
96
  cd(dir)
51
97
  end
52
98
 
@@ -61,11 +107,21 @@ When /display stderr/ do
61
107
  end
62
108
 
63
109
 
110
+ When /(?:delete|unset) the env variable "([^\"]*)"$/ do |var|
111
+ remove_env(var)
112
+ end
113
+
114
+
64
115
  When /display stdout/ do
65
116
  announce_or_puts(last_stdout)
66
117
  end
67
118
 
68
119
 
120
+ When /using a clean gemset "([^\"]*)"$/ do |gemset|
121
+ use_clean_gemset(gemset)
122
+ end
123
+
124
+
69
125
  When /do(?:es)? have (?:a|the) directory named "([^\"]*)"$/ do |dir_name|
70
126
  create_dir(dir_name)
71
127
  end
@@ -93,32 +149,48 @@ When /exit status should not be (-?\d+)$/ do |exit_status|
93
149
  end
94
150
 
95
151
 
96
- When /file "([^\"]*)" should contain "([^\"]*)"$/ do |file, partial_content|
152
+ When /file (?:named )?"([^\"]*)" should contain "([^\"]*)"$/\
153
+ do |file, partial_content|
97
154
  check_file_content(file, partial_content, true)
98
155
  end
99
156
 
100
157
 
101
- When /file "([^\"]*)" should contain:$/ do |file, partial_content|
158
+ When /file (?:named )?"([^\"]*)" should contain:$/\
159
+ do |file, partial_content|
102
160
  check_file_content(file, partial_content, true)
103
161
  end
104
162
 
105
163
 
106
- When /file "([^\"]*)" should not contain "([^\"]*)"$/ do |file, partial_content|
164
+ When /file (?:named )?"([^\"]*)" should not contain "([^\"]*)"$/\
165
+ do |file, partial_content|
107
166
  check_file_content(file, partial_content, false)
108
167
  end
109
168
 
110
169
 
111
- When /file "([^\"]*)" should not contain:$/ do |file, partial_content|
170
+ When /file (?:named )?"([^\"]*)" should not contain:$/\
171
+ do |file, partial_content|
112
172
  check_file_content(file, partial_content, false)
113
173
  end
114
174
 
115
175
 
116
- When /file "([^\"]*)" should not match \/([^\/]*)\/$/ do |file, partial_content|
176
+ When /file (?:named )?"([^\"]*)" should exist$/ do |file|
177
+ check_file_presence([file_name], true)
178
+ end
179
+
180
+
181
+ When /file (?:named )?"([^\"]*)" should not exist$/ do |file|
182
+ check_file_presence([file], false)
183
+ end
184
+
185
+
186
+ When /file (?:named )?"([^\"]*)" should not match \/([^\/]*)\/$/\
187
+ do |file, partial_content|
117
188
  check_file_content(file, /#{partial_content}/, false)
118
189
  end
119
190
 
120
191
 
121
- When /file "([^\"]*)" should match \/([^\/]*)\/$/ do |file, partial_content|
192
+ When /file (?:named )?"([^\"]*)" should match \/([^\/]*)\/$/\
193
+ do |file, partial_content|
122
194
  check_file_content(file, /#{partial_content}/, true)
123
195
  end
124
196
 
@@ -146,7 +218,7 @@ end
146
218
 
147
219
 
148
220
  When /output should contain "([^\"]*)"$/ do |partial_output|
149
- combined_output.should =~ regexp(partial_output)
221
+ assert_partial_output(partial_output)
150
222
  end
151
223
 
152
224
 
@@ -189,6 +261,11 @@ When /output should match:$/ do |partial_output|
189
261
  end
190
262
 
191
263
 
264
+ When /overwrites? "([^\"]*)" with:$/ do |file_name, file_content|
265
+ create_file(file_name, file_content, true)
266
+ end
267
+
268
+
192
269
  When /rebase the directory "()"$/ do |dir|
193
270
  rebase(dir.to_a)
194
271
  end
@@ -199,50 +276,45 @@ When /rebase the directory named "([^\"]*)"$/ do |dir|
199
276
  end
200
277
 
201
278
 
202
- When /run "(.*)"$/ do |cmd|
203
- run(unescape(cmd), false)
279
+ When /removes? the file "([^\"]*)"$/ do |file_name|
280
+ remove_file(file_name)
204
281
  end
205
282
 
206
283
 
207
- When /run "(.*)" interactively$/ do |cmd|
208
- run_interactive(unescape(cmd))
284
+ When /runs? "(.*)"$/ do |cmd|
285
+ run(unescape(cmd), false)
209
286
  end
210
287
 
211
288
 
212
- When /run "(.*)" with errors?(?: and timeout of "(\d+\.?\d*)" seconds?)?$/\
289
+ When /runs? "(.*)" with errors?(?: and timeout of "(\d+\.?\d*)" seconds?)?$/\
213
290
  do |cmd, time|
214
291
  run(unescape(cmd), false, time)
215
292
  end
216
293
 
217
-
218
- When /run "(.*)" with timeout of "(\d+\.?\d*)" seconds?$/ do |cmd, time|
294
+ When /runs? "(.*)" without errors?(?: and timeout of "(\d+\.?\d*)" seconds?)?$/\
295
+ do |cmd, time|
219
296
  run(unescape(cmd), true, time)
220
297
  end
221
298
 
222
299
 
223
- When /run "(.*)" without errors?(?: and timeout of "(\d+\.?\d*)" seconds?)?$/\
224
- do |cmd, time|
225
- run(unescape(cmd), true, time)
300
+ When /runs? "([^\"]*)" interactively$/ do |cmd|
301
+ run_interactive(unescape(cmd))
226
302
  end
227
303
 
228
304
 
229
- When /set the env variable "([^\"]*)" to "(\d+\.?\d*)" seconds?$/ do |var, val|
230
- ENV[var] = val
305
+ When /(?:successfully )?runs? "(.*)" with timeout of "(\d+\.?\d*)" seconds??$/\
306
+ do |cmd, time|
307
+ run(unescape(cmd), true, time)
231
308
  end
232
309
 
233
310
 
234
311
  When /should (pass|fail) with:$/ do |pass_fail, partial_output|
235
- When "output should contain:", partial_output
236
- if pass_fail == 'pass'
237
- @last_exit_status.should == 0
238
- else
239
- @last_exit_status.should_not == 0
240
- end
312
+ self.__send__("assert_#{pass_fail}ing_with", partial_output)
241
313
  end
242
314
 
243
315
 
244
316
  When /should (pass|fail) with regexp?:$/ do |pass_fail, partial_output|
245
- Then "the output should match:", partial_output
317
+ When "output should match:", partial_output
246
318
  if pass_fail == 'pass'
247
319
  @last_exit_status.should == 0
248
320
  else
@@ -256,6 +328,21 @@ When /stderr should be empty$/ do
256
328
  end
257
329
 
258
330
 
331
+ When /stdout should be empty$/ do
332
+ @last_stdout.should == ""
333
+ end
334
+
335
+
336
+ When /stderr should not be empty$/ do
337
+ @last_stderr.should != ""
338
+ end
339
+
340
+
341
+ When /stdout should not be empty$/ do
342
+ @last_stdout.should != ""
343
+ end
344
+
345
+
259
346
  When /stderr should contain "([^\"]*)"$/ do |partial_output|
260
347
  @last_stderr.should =~ regexp(partial_output)
261
348
  end
@@ -276,7 +363,7 @@ When /stdout should not contain "([^\"]*)"$/ do |partial_output|
276
363
  end
277
364
 
278
365
 
279
- When /type "([^\"]*)"$/ do |input|
366
+ When /types? "([^\"]*)"$/ do |input|
280
367
  write_interactive(ensure_newline(input))
281
368
  end
282
369
 
@@ -284,3 +371,8 @@ end
284
371
  When /(?:use|using) a clean gemset "([^\"]*)"$/ do |gemset|
285
372
  use_clean_gemset(gemset)
286
373
  end
374
+
375
+
376
+ When /writes? to "([^\"]*)" with:$/ do |file_name, file_content|
377
+ create_file(file_name, file_content, false)
378
+ end
data/lib/aruba.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'pathname'
1
+ require "pathname"
2
2
  lib_path = Pathname.new(File.dirname(__FILE__)).realpath.to_s + '/'
3
3
  unless ENV['NO_ARUBA_STEPS']
4
4
  require lib_path + 'aruba/cucumber_steps'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aruba-jbb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 81
4
+ hash: 95
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 6
10
- - 11
11
- version: 0.2.6.11
10
+ - 12
11
+ version: 0.2.6.12
12
12
  platform: ruby
13
13
  authors:
14
14
  - "Aslak Helles\xC3\xB8y"
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2010-10-26 00:00:00 -04:00
22
+ date: 2010-11-04 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -30,12 +30,12 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- hash: 59
33
+ hash: 61
34
34
  segments:
35
35
  - 0
36
36
  - 9
37
- - 0
38
- version: 0.9.0
37
+ - 3
38
+ version: 0.9.3
39
39
  type: :runtime
40
40
  version_requirements: *id001
41
41
  - !ruby/object:Gem::Dependency
@@ -60,12 +60,12 @@ dependencies:
60
60
  requirements:
61
61
  - - ~>
62
62
  - !ruby/object:Gem::Version
63
- hash: 15
63
+ hash: 13
64
64
  segments:
65
65
  - 2
66
66
  - 0
67
- - 0
68
- version: 2.0.0
67
+ - 1
68
+ version: 2.0.1
69
69
  type: :development
70
70
  version_requirements: *id003
71
71
  description: Fork of Aruba, Cucumber steps for testing CLI applications.
@@ -96,6 +96,7 @@ files:
96
96
  - features/interactive.feature
97
97
  - features/output.feature
98
98
  - features/process_timeout.feature
99
+ - features/std_out.feature
99
100
  - features/step_definitions/aruba_dev_steps.rb
100
101
  - features/support/env.rb
101
102
  - lib/aruba.rb
@@ -145,5 +146,6 @@ test_files:
145
146
  - features/interactive.feature
146
147
  - features/output.feature
147
148
  - features/process_timeout.feature
149
+ - features/std_out.feature
148
150
  - features/step_definitions/aruba_dev_steps.rb
149
151
  - features/support/env.rb