aruba 0.9.0 → 0.10.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/Gemfile +2 -0
- data/History.md +23 -1
- data/README.md +2 -2
- data/aruba.gemspec +1 -1
- data/cucumber.yml +4 -0
- data/features/api/command/run.feature +18 -0
- data/features/api/environment/remove_environment_variable.feature +63 -0
- data/features/api/environment/set_environment_variable.feature +47 -10
- data/features/api/{command → text}/extract_text.feature +4 -24
- data/features/api/text/sanitize_text.feature +228 -0
- data/features/api/{command → text}/unescape_text.feature +9 -13
- data/features/cli/init.feature +79 -0
- data/features/commands/output/all_output.feature +1 -0
- data/features/getting_started/supported_testing_frameworks.feature +104 -0
- data/features/output.feature +3 -2
- data/features/step_definitions/aruba_dev_steps.rb +1 -60
- data/features/step_definitions/hooks.rb +6 -0
- data/fixtures/empty-app/README.md +1 -11
- data/lib/aruba/api.rb +2 -0
- data/lib/aruba/api/command.rb +0 -19
- data/lib/aruba/api/deprecated.rb +6 -3
- data/lib/aruba/api/environment.rb +18 -0
- data/lib/aruba/api/filesystem.rb +1 -1
- data/lib/aruba/api/text.rb +41 -0
- data/lib/aruba/cli.rb +11 -0
- data/lib/aruba/console.rb +3 -2
- data/lib/aruba/cucumber.rb +1 -0
- data/lib/aruba/cucumber/command.rb +44 -88
- data/lib/aruba/cucumber/environment.rb +7 -3
- data/lib/aruba/cucumber/file.rb +14 -17
- data/lib/aruba/cucumber/hooks.rb +1 -0
- data/lib/aruba/cucumber/testing_frameworks.rb +95 -0
- data/lib/aruba/initializer.rb +185 -0
- data/lib/aruba/matchers/collection/all.rb +9 -0
- data/lib/aruba/matchers/command/have_output.rb +1 -2
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +1 -2
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +1 -2
- data/lib/aruba/matchers/string.rb +1 -0
- data/lib/aruba/matchers/string/include_output_string.rb +36 -0
- data/lib/aruba/matchers/string/match_output_string.rb +37 -0
- data/lib/aruba/matchers/string/output_string_eq.rb +35 -0
- data/lib/aruba/platforms/local_environment.rb +2 -0
- data/lib/aruba/platforms/unix_environment_variables.rb +10 -0
- data/lib/aruba/platforms/unix_platform.rb +3 -1
- data/lib/aruba/platforms/windows_environment_variables.rb +4 -0
- data/lib/aruba/processes/spawn_process.rb +6 -2
- data/lib/aruba/version.rb +1 -1
- metadata +28 -16
- data/fixtures/empty-app/bin/cli +0 -6
- data/fixtures/empty-app/script/console +0 -14
- data/fixtures/empty-app/spec/spec_helper.rb +0 -9
- data/lib/aruba/matchers/collection/all_objects.rb +0 -2
@@ -0,0 +1,37 @@
|
|
1
|
+
# @!method match_output_string(string)
|
2
|
+
# This matchers checks if the output string of a command matches regular expression.
|
3
|
+
#
|
4
|
+
# @param [Integer] status
|
5
|
+
# The value of the exit status
|
6
|
+
#
|
7
|
+
# @return [TrueClass, FalseClass] The result
|
8
|
+
#
|
9
|
+
# false:
|
10
|
+
# * if the output string does not match regex
|
11
|
+
# true:
|
12
|
+
# * if the output string matches regex
|
13
|
+
#
|
14
|
+
# @example Use matcher
|
15
|
+
#
|
16
|
+
# RSpec.describe do
|
17
|
+
# it { expect(last_command_started).to have_output an_output_string_matching regex) }
|
18
|
+
# it { expect(last_command_started).to have_output match_output_string regex) }
|
19
|
+
# end
|
20
|
+
RSpec::Matchers.define :match_output_string do |expected|
|
21
|
+
match do |actual|
|
22
|
+
@expected = Regexp.new(unescape_text(expected), Regexp::MULTILINE)
|
23
|
+
@actual = sanitize_text(actual)
|
24
|
+
|
25
|
+
values_match? @expected, @actual
|
26
|
+
end
|
27
|
+
|
28
|
+
diffable
|
29
|
+
|
30
|
+
description { "output string matches: #{description_of expected}" }
|
31
|
+
end
|
32
|
+
|
33
|
+
if RSpec::Expectations::Version::STRING >= '3.0'
|
34
|
+
RSpec::Matchers.alias_matcher :an_output_string_matching, :match_output_string
|
35
|
+
RSpec::Matchers.alias_matcher :a_file_name_matching, :match_output_string
|
36
|
+
RSpec::Matchers.alias_matcher :file_content_matching, :match_output_string
|
37
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# @!method output_string_eq(string)
|
2
|
+
# This matchers checks if the output string of a command includes string.
|
3
|
+
#
|
4
|
+
# @param [Integer] status
|
5
|
+
# The value of the exit status
|
6
|
+
#
|
7
|
+
# @return [TrueClass, FalseClass] The result
|
8
|
+
#
|
9
|
+
# false:
|
10
|
+
# * if the output string does not include string
|
11
|
+
# true:
|
12
|
+
# * if the output string includes string
|
13
|
+
#
|
14
|
+
# @example Use matcher
|
15
|
+
#
|
16
|
+
# RSpec.describe do
|
17
|
+
# it { expect(last_command_started).to have_output output_string_eq string) }
|
18
|
+
# it { expect(last_command_started).to have_output an_output_string_begin_eq string) }
|
19
|
+
# end
|
20
|
+
RSpec::Matchers.define :output_string_eq do |expected|
|
21
|
+
match do |actual|
|
22
|
+
@expected = sanitize_text(expected.to_s)
|
23
|
+
@actual = sanitize_text(actual.to_s)
|
24
|
+
|
25
|
+
values_match? @expected, @actual
|
26
|
+
end
|
27
|
+
|
28
|
+
diffable
|
29
|
+
|
30
|
+
description { "output string is eq: #{description_of expected}" }
|
31
|
+
end
|
32
|
+
|
33
|
+
if RSpec::Expectations::Version::STRING >= '3.0'
|
34
|
+
RSpec::Matchers.alias_matcher :an_output_string_being_eq, :output_string_eq
|
35
|
+
end
|
@@ -107,6 +107,16 @@ module Aruba
|
|
107
107
|
self
|
108
108
|
end
|
109
109
|
|
110
|
+
# Delete variable
|
111
|
+
#
|
112
|
+
# @param [#to_s] name
|
113
|
+
# The name of the variable
|
114
|
+
def delete(name)
|
115
|
+
env.delete name.to_s
|
116
|
+
|
117
|
+
self
|
118
|
+
end
|
119
|
+
|
110
120
|
# Convert to hash
|
111
121
|
#
|
112
122
|
# @return [Hash]
|
@@ -217,7 +217,9 @@ module Aruba
|
|
217
217
|
# @return
|
218
218
|
# The string stripped from escape sequences
|
219
219
|
def unescape(string, keep_ansi = true)
|
220
|
-
|
220
|
+
# rubocop:disable Metrics/LineLength
|
221
|
+
deprecated('The use of "Aruba.platform.unescape" is deprecated. Please use "#unescape_text" and "#sanitize_text" instead. But be aware it uses a different implementation')
|
222
|
+
# rubocop:enable Metrics/LineLength
|
221
223
|
|
222
224
|
string = string.gsub('\n', "\n").gsub('\"', '"').gsub('\e', "\e")
|
223
225
|
string = string.gsub(/\e\[\d+(?>(;\d+)*)m/, '') unless keep_ansi
|
@@ -53,8 +53,12 @@ module Aruba
|
|
53
53
|
cmd = Aruba.platform.command_string.new(cmd)
|
54
54
|
|
55
55
|
@process = ChildProcess.build(*[cmd.to_a, arguments].flatten)
|
56
|
-
@stdout_file = Tempfile.new("aruba-stdout")
|
57
|
-
@stderr_file = Tempfile.new("aruba-stderr")
|
56
|
+
@stdout_file = Tempfile.new("aruba-stdout-")
|
57
|
+
@stderr_file = Tempfile.new("aruba-stderr-")
|
58
|
+
|
59
|
+
@stdout_file.sync = true
|
60
|
+
@stderr_file.sync = true
|
61
|
+
|
58
62
|
@exit_status = nil
|
59
63
|
@duplex = true
|
60
64
|
|
data/lib/aruba/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aruba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2015-
|
16
|
+
date: 2015-10-17 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: cucumber
|
@@ -113,8 +113,8 @@ dependencies:
|
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: 1.10.2
|
116
|
-
description: Extension for popular TDD and BDD frameworks like "Cucumber"
|
117
|
-
to make testing commandline applications meaningful, easy and fun.
|
116
|
+
description: Extension for popular TDD and BDD frameworks like "Cucumber", "RSpec"
|
117
|
+
and "Minitest" to make testing commandline applications meaningful, easy and fun.
|
118
118
|
email: cukes@googlegroups.com
|
119
119
|
executables:
|
120
120
|
- aruba
|
@@ -143,15 +143,14 @@ files:
|
|
143
143
|
- doc/dependency_decisions.yml
|
144
144
|
- features/.nav
|
145
145
|
- features/announce.feature
|
146
|
-
- features/api/command/extract_text.feature
|
147
146
|
- features/api/command/run.feature
|
148
147
|
- features/api/command/stop_all_commands.feature
|
149
148
|
- features/api/command/terminate_all_commands.feature
|
150
|
-
- features/api/command/unescape_text.feature
|
151
149
|
- features/api/command/which.feature
|
152
150
|
- features/api/core/expand_path.feature
|
153
151
|
- features/api/environment/append_environment_variable.feature
|
154
152
|
- features/api/environment/prepend_environment_variable.feature
|
153
|
+
- features/api/environment/remove_environment_variable.feature
|
155
154
|
- features/api/environment/set_environment_variable.feature
|
156
155
|
- features/api/filesystem/cd.feature
|
157
156
|
- features/api/filesystem/create_directory.feature
|
@@ -162,7 +161,11 @@ files:
|
|
162
161
|
- features/api/filesystem/is_file.feature
|
163
162
|
- features/api/filesystem/is_relative.feature
|
164
163
|
- features/api/filesystem/move.feature
|
164
|
+
- features/api/text/extract_text.feature
|
165
|
+
- features/api/text/sanitize_text.feature
|
166
|
+
- features/api/text/unescape_text.feature
|
165
167
|
- features/cli/console.feature
|
168
|
+
- features/cli/init.feature
|
166
169
|
- features/commands/debug_command.feature
|
167
170
|
- features/commands/environment_variables.feature
|
168
171
|
- features/commands/flushing.feature
|
@@ -187,6 +190,7 @@ files:
|
|
187
190
|
- features/development/test.feature
|
188
191
|
- features/file_system_commands.feature
|
189
192
|
- features/getting_started/supported_programming_languages.feature
|
193
|
+
- features/getting_started/supported_testing_frameworks.feature
|
190
194
|
- features/hooks/after/command.feature
|
191
195
|
- features/hooks/before/command.feature
|
192
196
|
- features/integration/rspec/getting_started.feature
|
@@ -238,12 +242,9 @@ files:
|
|
238
242
|
- fixtures/empty-app/.rspec
|
239
243
|
- fixtures/empty-app/README.md
|
240
244
|
- fixtures/empty-app/Rakefile
|
241
|
-
- fixtures/empty-app/bin/cli
|
242
245
|
- fixtures/empty-app/cli-app.gemspec
|
243
246
|
- fixtures/empty-app/lib/cli/app.rb
|
244
247
|
- fixtures/empty-app/lib/cli/app/version.rb
|
245
|
-
- fixtures/empty-app/script/console
|
246
|
-
- fixtures/empty-app/spec/spec_helper.rb
|
247
248
|
- fixtures/fixtures-app/test.txt
|
248
249
|
- fixtures/getting-started-app/.gitignore
|
249
250
|
- fixtures/getting-started-app/Gemfile
|
@@ -259,6 +260,7 @@ files:
|
|
259
260
|
- lib/aruba/api/environment.rb
|
260
261
|
- lib/aruba/api/filesystem.rb
|
261
262
|
- lib/aruba/api/rvm.rb
|
263
|
+
- lib/aruba/api/text.rb
|
262
264
|
- lib/aruba/aruba_logger.rb
|
263
265
|
- lib/aruba/aruba_path.rb
|
264
266
|
- lib/aruba/basic_configuration.rb
|
@@ -281,15 +283,17 @@ files:
|
|
281
283
|
- lib/aruba/cucumber/file.rb
|
282
284
|
- lib/aruba/cucumber/hooks.rb
|
283
285
|
- lib/aruba/cucumber/rvm.rb
|
286
|
+
- lib/aruba/cucumber/testing_frameworks.rb
|
284
287
|
- lib/aruba/errors.rb
|
285
288
|
- lib/aruba/extensions/string/strip.rb
|
286
289
|
- lib/aruba/file_size.rb
|
287
290
|
- lib/aruba/hooks.rb
|
288
291
|
- lib/aruba/in_process.rb
|
292
|
+
- lib/aruba/initializer.rb
|
289
293
|
- lib/aruba/jruby.rb
|
290
294
|
- lib/aruba/matchers/base/base_matcher.rb
|
291
295
|
- lib/aruba/matchers/collection.rb
|
292
|
-
- lib/aruba/matchers/collection/
|
296
|
+
- lib/aruba/matchers/collection/all.rb
|
293
297
|
- lib/aruba/matchers/collection/include_an_object.rb
|
294
298
|
- lib/aruba/matchers/command.rb
|
295
299
|
- lib/aruba/matchers/command/be_successfully_executed.rb
|
@@ -316,6 +320,10 @@ files:
|
|
316
320
|
- lib/aruba/matchers/path/match_path_pattern.rb
|
317
321
|
- lib/aruba/matchers/rspec.rb
|
318
322
|
- lib/aruba/matchers/rspec_matcher_include_regexp.rb
|
323
|
+
- lib/aruba/matchers/string.rb
|
324
|
+
- lib/aruba/matchers/string/include_output_string.rb
|
325
|
+
- lib/aruba/matchers/string/match_output_string.rb
|
326
|
+
- lib/aruba/matchers/string/output_string_eq.rb
|
319
327
|
- lib/aruba/platform.rb
|
320
328
|
- lib/aruba/platforms/aruba_file_creator.rb
|
321
329
|
- lib/aruba/platforms/aruba_fixed_size_file_creator.rb
|
@@ -415,26 +423,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
415
423
|
version: 1.8.7
|
416
424
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
417
425
|
requirements:
|
418
|
-
- - "
|
426
|
+
- - ">"
|
419
427
|
- !ruby/object:Gem::Version
|
420
|
-
version:
|
428
|
+
version: 1.3.1
|
421
429
|
requirements: []
|
422
430
|
rubyforge_project:
|
423
|
-
rubygems_version: 2.4.5
|
431
|
+
rubygems_version: 2.4.5.1
|
424
432
|
signing_key:
|
425
433
|
specification_version: 4
|
426
|
-
summary: aruba-0.
|
434
|
+
summary: aruba-0.10.0.pre
|
427
435
|
test_files:
|
428
436
|
- features/announce.feature
|
429
|
-
- features/api/command/extract_text.feature
|
430
437
|
- features/api/command/run.feature
|
431
438
|
- features/api/command/stop_all_commands.feature
|
432
439
|
- features/api/command/terminate_all_commands.feature
|
433
|
-
- features/api/command/unescape_text.feature
|
434
440
|
- features/api/command/which.feature
|
435
441
|
- features/api/core/expand_path.feature
|
436
442
|
- features/api/environment/append_environment_variable.feature
|
437
443
|
- features/api/environment/prepend_environment_variable.feature
|
444
|
+
- features/api/environment/remove_environment_variable.feature
|
438
445
|
- features/api/environment/set_environment_variable.feature
|
439
446
|
- features/api/filesystem/cd.feature
|
440
447
|
- features/api/filesystem/create_directory.feature
|
@@ -445,7 +452,11 @@ test_files:
|
|
445
452
|
- features/api/filesystem/is_file.feature
|
446
453
|
- features/api/filesystem/is_relative.feature
|
447
454
|
- features/api/filesystem/move.feature
|
455
|
+
- features/api/text/extract_text.feature
|
456
|
+
- features/api/text/sanitize_text.feature
|
457
|
+
- features/api/text/unescape_text.feature
|
448
458
|
- features/cli/console.feature
|
459
|
+
- features/cli/init.feature
|
449
460
|
- features/commands/debug_command.feature
|
450
461
|
- features/commands/environment_variables.feature
|
451
462
|
- features/commands/flushing.feature
|
@@ -470,6 +481,7 @@ test_files:
|
|
470
481
|
- features/development/test.feature
|
471
482
|
- features/file_system_commands.feature
|
472
483
|
- features/getting_started/supported_programming_languages.feature
|
484
|
+
- features/getting_started/supported_testing_frameworks.feature
|
473
485
|
- features/hooks/after/command.feature
|
474
486
|
- features/hooks/before/command.feature
|
475
487
|
- features/integration/rspec/getting_started.feature
|
data/fixtures/empty-app/bin/cli
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'cli/app'
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require 'irb'
|
14
|
-
IRB.start
|
@@ -1,9 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
-
|
3
|
-
require 'cli/app'
|
4
|
-
|
5
|
-
if RUBY_VERSION < '1.9.3'
|
6
|
-
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
|
7
|
-
else
|
8
|
-
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
|
9
|
-
end
|