aruba 0.7.4 → 0.8.0.pre
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.nav +12 -0
- data/.rspec +1 -0
- data/.rubocop.yml +12 -0
- data/.simplecov +2 -0
- data/.travis.yml +5 -6
- data/Gemfile +53 -26
- data/History.md +17 -0
- data/LICENSE +1 -1
- data/README.md +45 -19
- data/Rakefile +12 -2
- data/TODO.md +3 -0
- data/aruba.gemspec +19 -8
- data/cucumber.yml +1 -1
- data/features/api/cd.feature +119 -0
- data/features/api/command/run.feature +37 -0
- data/features/api/command/which.feature +37 -0
- data/features/api/environment/append_environment_variable.feature +118 -0
- data/features/api/environment/prepend_environment_variable.feature +118 -0
- data/features/api/environment/set_environment_variable.feature +252 -0
- data/features/configuration/exit_timeout.feature +51 -0
- data/features/configuration/fixtures_directories.feature +31 -0
- data/features/configuration/fixtures_path_prefix.feature +24 -0
- data/features/configuration/io_timeout.feature +31 -0
- data/features/configuration/keep_ansi.feature +31 -0
- data/features/configuration/root_directory.feature +31 -0
- data/features/configuration/working_directory.feature +32 -0
- data/features/fixtures/cli-app/.gitignore +9 -0
- data/features/fixtures/cli-app/.rspec +2 -0
- data/features/fixtures/cli-app/README.md +34 -0
- data/features/fixtures/cli-app/Rakefile +1 -0
- data/features/fixtures/cli-app/bin/cli +6 -0
- data/features/fixtures/cli-app/cli-app.gemspec +26 -0
- data/features/fixtures/cli-app/features/support/env.rb +1 -0
- data/features/fixtures/cli-app/lib/cli/app.rb +13 -0
- data/features/fixtures/cli-app/lib/cli/app/version.rb +5 -0
- data/features/fixtures/cli-app/script/console +14 -0
- data/features/fixtures/cli-app/spec/cli/app_spec.rb +7 -0
- data/features/fixtures/cli-app/spec/spec_helper.rb +10 -0
- data/features/fixtures/copy/file.txt +1 -1
- data/features/hooks/after/command.feature +34 -0
- data/features/hooks/before/command.feature +61 -0
- data/features/matchers/directory/have_sub_directory.feature +110 -0
- data/features/matchers/file/be_existing_file.feature +82 -0
- data/features/matchers/file/have_file_content.feature +123 -0
- data/features/matchers/file/have_file_size.feature +107 -0
- data/features/matchers/path/be_an_absolute_path.feature +74 -0
- data/features/matchers/path/be_an_existing_path.feature +97 -0
- data/features/matchers/path/have_permissions.feature +118 -0
- data/features/matchers/timeouts.feature +48 -0
- data/features/step_definitions/aruba_dev_steps.rb +69 -1
- data/features/steps/commands/exit_statuses.feature +136 -0
- data/features/steps/commands/in_process.feature +129 -0
- data/features/steps/commands/run.feature +36 -0
- data/features/steps/environment/home_variable.feature +49 -0
- data/features/steps/environment/set_environment_variable.feature +34 -0
- data/features/support/aruba.rb +5 -0
- data/features/support/env.rb +8 -4
- data/lib/aruba.rb +20 -8
- data/lib/aruba/announcer.rb +1 -0
- data/lib/aruba/api.rb +18 -1179
- data/lib/aruba/api/command.rb +351 -0
- data/lib/aruba/api/core.rb +141 -0
- data/lib/aruba/api/deprecated.rb +549 -0
- data/lib/aruba/api/environment.rb +61 -0
- data/lib/aruba/api/filesystem.rb +305 -0
- data/lib/aruba/api/rvm.rb +39 -0
- data/lib/aruba/aruba_path.rb +75 -0
- data/lib/aruba/basic_configuration.rb +208 -0
- data/lib/aruba/basic_configuration/option.rb +25 -0
- data/lib/aruba/config.rb +43 -30
- data/lib/aruba/config/jruby.rb +14 -0
- data/lib/aruba/config_wrapper.rb +17 -0
- data/lib/aruba/contracts/relative_path.rb +13 -0
- data/lib/aruba/creators/aruba_file_creator.rb +32 -0
- data/lib/aruba/creators/aruba_fixed_size_file_creator.rb +32 -0
- data/lib/aruba/cucumber.rb +87 -53
- data/lib/aruba/cucumber/hooks.rb +65 -10
- data/lib/aruba/environment.rb +121 -0
- data/lib/aruba/errors.rb +3 -0
- data/lib/aruba/extensions/string/strip.rb +24 -0
- data/lib/aruba/hooks.rb +54 -0
- data/lib/aruba/jruby.rb +4 -9
- data/lib/aruba/matchers/command.rb +1 -79
- data/lib/aruba/matchers/command/be_successfully_executed.rb +30 -0
- data/lib/aruba/matchers/command/have_exit_status.rb +47 -0
- data/lib/aruba/matchers/command/have_finished_in_time.rb +42 -0
- data/lib/aruba/matchers/directory.rb +1 -59
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +34 -0
- data/lib/aruba/matchers/directory/have_sub_directory.rb +49 -0
- data/lib/aruba/matchers/file.rb +1 -177
- data/lib/aruba/matchers/file/be_an_existing_file.rb +34 -0
- data/lib/aruba/matchers/file/have_file_content.rb +58 -0
- data/lib/aruba/matchers/file/have_file_size.rb +43 -0
- data/lib/aruba/matchers/file/have_same_file_content.rb +44 -0
- data/lib/aruba/matchers/path.rb +1 -99
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +21 -0
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +32 -0
- data/lib/aruba/matchers/path/be_an_existing_path.rb +33 -0
- data/lib/aruba/matchers/path/have_permissions.rb +60 -0
- data/lib/aruba/matchers/path/match_path_pattern.rb +41 -0
- data/lib/aruba/matchers/rspec.rb +0 -0
- data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +1 -1
- data/lib/aruba/platform.rb +230 -0
- data/lib/aruba/process_monitor.rb +23 -5
- data/lib/aruba/processes/basic_process.rb +35 -1
- data/lib/aruba/processes/debug_process.rb +26 -15
- data/lib/aruba/processes/in_process.rb +21 -9
- data/lib/aruba/processes/spawn_process.rb +29 -19
- data/lib/aruba/reporting.rb +2 -0
- data/lib/aruba/rspec.rb +61 -13
- data/lib/aruba/runtime.rb +33 -0
- data/script/bootstrap +4 -6
- data/spec/aruba/api/runtime_spec.rb +28 -0
- data/spec/aruba/api_spec.rb +129 -126
- data/spec/aruba/aruba_path_spec.rb +65 -0
- data/spec/aruba/basic_configuration_spec.rb +5 -0
- data/spec/aruba/config_wrapper_spec.rb +25 -0
- data/spec/aruba/configuration_spec.rb +5 -0
- data/spec/aruba/jruby_spec.rb +34 -18
- data/spec/aruba/matchers/directory_spec.rb +6 -7
- data/spec/aruba/matchers/file_spec.rb +16 -20
- data/spec/aruba/matchers/path_spec.rb +14 -11
- data/spec/aruba/rspec_spec.rb +15 -0
- data/spec/aruba/runtime_spec.rb +29 -0
- data/spec/aruba/spawn_process_spec.rb +2 -2
- data/spec/spec_helper.rb +10 -2
- data/spec/support/configs/rspec.rb +1 -1
- data/spec/support/matchers/option.rb +35 -0
- data/spec/support/shared_contexts/aruba.rb +10 -8
- data/spec/support/shared_examples/configuration.rb +116 -0
- metadata +182 -33
- data/.rvmrc +0 -1
- data/features/before_cmd_hooks.feature +0 -61
- data/features/command_environment_variables.feature +0 -31
- data/features/custom_ruby_process.feature +0 -12
- data/features/exit_statuses.feature +0 -30
- data/features/support/custom_main.rb +0 -28
- data/lib/aruba/matchers/mode.rb +0 -52
- data/lib/aruba/utils.rb +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ec87d782ab5f0a8a1d6edf4343984e6ffc3dd5c
|
|
4
|
+
data.tar.gz: fcfdff23c0e86bd7dc4d731497ef8cfe8e9ccc4c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69ff1ae834613808920fb628a982a55438835504362e2bf4aa82955c57597c52e6a5318247e636693b058d9e55a2f64942f424fbb316d845b2295d93544019c4
|
|
7
|
+
data.tar.gz: f362bb7494704d5f9c331931dc6f29b4258bb46037a6646c38d75d7c104038a187156d0581d87b0b33367edabd17ecf1ae918d66b857d9937ced97f7c4db5acb
|
data/.gitignore
CHANGED
data/.nav
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
# before_cmd_hooks.feature
|
|
3
|
+
# command_environment_variables.feature
|
|
4
|
+
# configuration-rspec.feature
|
|
5
|
+
# custom_ruby_process.feature
|
|
6
|
+
# exit_statuses.feature
|
|
7
|
+
# file_system_commands.feature
|
|
8
|
+
# flushing.feature
|
|
9
|
+
# interactive.feature
|
|
10
|
+
# no_clobber.feature
|
|
11
|
+
# output.feature
|
|
12
|
+
# utf-8.feature
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -10,6 +10,8 @@ Style/HashSyntax:
|
|
|
10
10
|
Metrics/ModuleLength:
|
|
11
11
|
Exclude:
|
|
12
12
|
- lib/aruba/api.rb
|
|
13
|
+
- lib/aruba/api/*.rb
|
|
14
|
+
- lib/aruba/platform.rb
|
|
13
15
|
|
|
14
16
|
Metrics/AbcSize:
|
|
15
17
|
Enabled: false
|
|
@@ -35,6 +37,10 @@ Lint/UselessAssignment:
|
|
|
35
37
|
# Configuration parameters: AllowURI.
|
|
36
38
|
Metrics/LineLength:
|
|
37
39
|
Max: 169
|
|
40
|
+
Exclude:
|
|
41
|
+
- lib/aruba/api.rb
|
|
42
|
+
- lib/aruba/api/deprecated.rb
|
|
43
|
+
- aruba.gemspec
|
|
38
44
|
|
|
39
45
|
# Configuration parameters: CountComments.
|
|
40
46
|
Metrics/MethodLength:
|
|
@@ -60,6 +66,9 @@ Style/ClassCheck:
|
|
|
60
66
|
Style/ClassVars:
|
|
61
67
|
Enabled: false
|
|
62
68
|
|
|
69
|
+
Metrics/ClassLength:
|
|
70
|
+
Enabled: false
|
|
71
|
+
|
|
63
72
|
# Cop supports --auto-correct.
|
|
64
73
|
# Configuration parameters: PreferredMethods.
|
|
65
74
|
Style/CollectionMethods:
|
|
@@ -88,6 +97,9 @@ Style/LeadingCommentSpace:
|
|
|
88
97
|
Style/PercentLiteralDelimiters:
|
|
89
98
|
Enabled: false
|
|
90
99
|
|
|
100
|
+
Metrics/PerceivedComplexity:
|
|
101
|
+
Enabled: false
|
|
102
|
+
|
|
91
103
|
# Configuration parameters: SupportedStyles.
|
|
92
104
|
Style/RaiseArgs:
|
|
93
105
|
# EnforcedStyle: compact
|
data/.simplecov
CHANGED
data/.travis.yml
CHANGED
|
@@ -3,15 +3,14 @@ language: ruby
|
|
|
3
3
|
script: script/test
|
|
4
4
|
install: script/bootstrap --without development debug
|
|
5
5
|
rvm:
|
|
6
|
-
- 2.
|
|
7
|
-
- 2.1.
|
|
8
|
-
- 2.1.3
|
|
9
|
-
- 2.1.2
|
|
10
|
-
- 2.1.1
|
|
11
|
-
- 2.1.0
|
|
6
|
+
- 2.2.2
|
|
7
|
+
- 2.1.6
|
|
12
8
|
- 2.0.0
|
|
9
|
+
- 1.9.3
|
|
10
|
+
- 1.8.7
|
|
13
11
|
- jruby-20mode
|
|
14
12
|
- jruby-21mode
|
|
13
|
+
- jruby
|
|
15
14
|
- rbx
|
|
16
15
|
matrix:
|
|
17
16
|
allow_failures:
|
data/Gemfile
CHANGED
|
@@ -1,40 +1,67 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
|
+
# Use dependencies from gemspec
|
|
3
4
|
gemspec
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
gem 'simplecov'
|
|
7
|
-
end
|
|
8
|
-
|
|
6
|
+
# Debug aruba
|
|
9
7
|
group :debug do
|
|
10
|
-
gem 'pry', '~> 0.10.1
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
gem 'pry', '~> 0.10.1'
|
|
9
|
+
|
|
10
|
+
platform :ruby_20, :ruby_21, :ruby_22, :jruby, :rbx do
|
|
11
|
+
gem 'byebug', '~> 4.0.5'
|
|
12
|
+
gem 'pry-byebug', '~> 3.1.0'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
platform :ruby_19 do
|
|
16
|
+
gem 'debugger', '~> 1.6.8'
|
|
17
|
+
gem 'pry-debugger', '~> 0.2.3'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
platform :ruby_19, :ruby_20, :ruby_21, :ruby_22, :jruby, :rbx do
|
|
21
|
+
gem 'pry-stack_explorer', '~> 0.4.9'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
gem 'pry-doc', '~> 0.8.0'
|
|
15
25
|
end
|
|
16
26
|
|
|
17
27
|
group :development, :test do
|
|
18
|
-
|
|
19
|
-
gem '
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
# Run development tasks
|
|
29
|
+
gem 'rake', '~> 10.4.2'
|
|
30
|
+
|
|
31
|
+
platform :ruby_19, :ruby_20, :ruby_21, :ruby_22, :jruby, :rbx do
|
|
32
|
+
# Reporting
|
|
33
|
+
gem 'bcat', '~> 0.6.2'
|
|
34
|
+
gem 'kramdown', '~> 1.7.0'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Code Coverage
|
|
38
|
+
gem 'simplecov', '~> 0.10'
|
|
39
|
+
|
|
40
|
+
# Test api
|
|
41
|
+
gem 'rspec', '~> 3.3.0'
|
|
42
|
+
gem 'fuubar', '~> 2.0.0'
|
|
43
|
+
|
|
44
|
+
# Make aruba compliant to ruby community guide
|
|
45
|
+
platform :ruby_19, :ruby_20, :ruby_21, :ruby_22, :jruby, :rbx do
|
|
46
|
+
gem 'rubocop', '~> 0.32.0'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
platform :ruby_19, :ruby_20, :ruby_21, :ruby_22, :jruby, :rbx do
|
|
50
|
+
gem 'cucumber-pro', '~> 0.0'
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
platform :ruby_19, :ruby_20, :ruby_21, :ruby_22, :jruby, :rbx do
|
|
54
|
+
# License compliance
|
|
55
|
+
gem 'license_finder', '~> 2.0.4'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
platform :ruby_19, :ruby_20, :ruby_21, :ruby_22, :jruby, :rbx do
|
|
59
|
+
# Upload documentation
|
|
60
|
+
gem 'relish', '~> 0.7.1'
|
|
61
|
+
end
|
|
27
62
|
end
|
|
28
63
|
|
|
29
64
|
platforms :rbx do
|
|
30
65
|
gem 'rubysl', '~> 2.0'
|
|
31
66
|
gem 'rubinius-developer_tools'
|
|
32
67
|
end
|
|
33
|
-
|
|
34
|
-
# Use source from sibling folders (if available) instead of gems
|
|
35
|
-
# %w[cucumber].each do |g|
|
|
36
|
-
# if File.directory?(File.dirname(__FILE__) + "/../#{g}")
|
|
37
|
-
# @dependencies.reject!{|dep| dep.name == g}
|
|
38
|
-
# gem g, :path => "../#{g}"
|
|
39
|
-
# end
|
|
40
|
-
# end
|
data/History.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [v0.8.0](https://github.com/cucumber/aruba/compare/v0.7.4...v0.8.0)
|
|
2
|
+
* Make aruba compatible with "ruby 1.8.7" and "ruby 1.9.3" again (fixes #279)
|
|
3
|
+
* Move more and more documentation to cucumber steps (partly fixes #268)
|
|
4
|
+
* Refactoring of test suits, now rspec tests run randomly
|
|
5
|
+
* Move Aruba constants to configuration class (fixes #271)
|
|
6
|
+
* Added runtime configuration via `aruba.config` which is reset for each test run
|
|
7
|
+
* Refactored hooks: now there are `after()` and `before()`-hooks, old
|
|
8
|
+
before_cmd-hook is still working, but is deprecated, added new
|
|
9
|
+
`after(:command)`-hook.
|
|
10
|
+
* Refactored jruby-startup helper
|
|
11
|
+
* Cleanup API by moving deprecated methods to separate class
|
|
12
|
+
* Cleanup Core API - reduced to `cd`, `expand_path`, `setup_aruba` and use expand_path wherever possible (fixes #253)
|
|
13
|
+
* Better isolation for environment variable manipulation - really helpful from 1.0.0 on
|
|
14
|
+
* Move configuration files like `jruby.rb` to `aruba/config/`-directory
|
|
15
|
+
* Change default exit timeout to 15 seconds to work around long running processes on travis
|
|
16
|
+
|
|
1
17
|
## [v0.7.4](https://github.com/cucumber/aruba/compare/v0.7.2...v0.7.4)
|
|
2
18
|
* Really Fixed post install message
|
|
3
19
|
|
|
@@ -21,6 +37,7 @@
|
|
|
21
37
|
* Improve development environment (issue #240)
|
|
22
38
|
* Cleanup process management (issue #257)
|
|
23
39
|
* Make path content available through matchers and api metchods (issue #250)
|
|
40
|
+
* Refactor announcer to support user defined announce channels (fixes #267)
|
|
24
41
|
|
|
25
42
|
## [v0.6.2](https://github.com/cucumber/aruba/compare/v0.6.1...v0.6.2)
|
|
26
43
|
* Fixed minor issue #223)
|
data/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2010
|
|
1
|
+
Copyright (c) 2010-2015 Aslak Hellesøy, David Chelimsky, Mike Sassak, Jarl Friis, Matt Wynne, Dennis Günnewig
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
|
@@ -1,24 +1,45 @@
|
|
|
1
|
-
[](http://travis-ci.org/cucumber/aruba)
|
|
2
2
|
[](http://badge.fury.io/rb/aruba)
|
|
3
|
-
[](https://gemnasium.com/cucumber/aruba)
|
|
4
|
+
[](https://codeclimate.com/github/cucumber/aruba)
|
|
5
5
|
[](https://gitter.im/cucumber/aruba?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`aruba` is an extension for popular TDD and BDD frameworks like "Cucumber" and "RSpec" to make testing of commandline applications meaningful, easy and fun.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
* Manipulate the file system
|
|
11
|
-
* Automatically reset state of file system between scenarios
|
|
9
|
+
Features at a glance:
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
* Test any command line application, implemented in any programming language - e.g. Bash, Python, Ruby, Java
|
|
12
|
+
* Manipulate the file system and the process environment
|
|
13
|
+
* Automatically reset state of file system and process environment between tests
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
Add this line to your application's `Gemfile`:
|
|
18
|
+
|
|
19
|
+
gem 'aruba'
|
|
20
|
+
|
|
21
|
+
And then execute:
|
|
22
|
+
|
|
23
|
+
$ bundle
|
|
24
|
+
|
|
25
|
+
Or install it yourself as:
|
|
26
|
+
|
|
27
|
+
$ gem install aruba
|
|
16
28
|
|
|
17
|
-
|
|
29
|
+
### Release Policy
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
We try to be compliant to [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html).
|
|
20
32
|
|
|
21
|
-
|
|
33
|
+
### Supported ruby versions
|
|
34
|
+
|
|
35
|
+
For an up to date list of all supported ruby versions, please see our [`.travis.yml`](https://github.com/cucumber/aruba/blob/master/.travis.yml). We only test against the latest version of a version branch - most times.
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
### Cucumber
|
|
40
|
+
|
|
41
|
+
To use `aruba` with cucumber, `require` the library in one of your ruby files
|
|
42
|
+
under `features/support` (e.g. `env.rb`)
|
|
22
43
|
|
|
23
44
|
```ruby
|
|
24
45
|
require 'aruba/cucumber'
|
|
@@ -122,22 +143,27 @@ Aruba defines several tags that you can put on on individual scenarios, or on a
|
|
|
122
143
|
|
|
123
144
|
To get more information on what Aruba is doing, use these tags:
|
|
124
145
|
|
|
125
|
-
* `@announce-
|
|
146
|
+
* `@announce-command` - See what command is run
|
|
126
147
|
* `@announce-stdout` - See the stdout
|
|
127
148
|
* `@announce-stderr` - See the stderr
|
|
128
|
-
* `@announce-
|
|
129
|
-
* `@announce-
|
|
149
|
+
* `@announce-output` - See the output of stdout and stderr
|
|
150
|
+
* `@announce-directory` - See the current directory
|
|
151
|
+
* `@announce-environment` - See environment variables set by Aruba
|
|
130
152
|
* `@announce` - Does all of the above
|
|
131
153
|
|
|
132
154
|
### Adding Hooks
|
|
133
155
|
|
|
134
|
-
You can hook into Aruba's lifecycle just before it runs a command:
|
|
156
|
+
You can hook into Aruba's lifecycle just before it runs a command and after it has run the command:
|
|
135
157
|
|
|
136
158
|
```ruby
|
|
137
159
|
Aruba.configure do |config|
|
|
138
|
-
config.
|
|
160
|
+
config.before :command do |cmd|
|
|
139
161
|
puts "About to run '#{cmd}'"
|
|
140
162
|
end
|
|
163
|
+
|
|
164
|
+
config.after :command do |cmd|
|
|
165
|
+
puts "After the run of '#{cmd}'"
|
|
166
|
+
end
|
|
141
167
|
end
|
|
142
168
|
```
|
|
143
169
|
|
|
@@ -216,7 +242,7 @@ or setting a hook like this example:
|
|
|
216
242
|
|
|
217
243
|
```ruby
|
|
218
244
|
Aruba.configure do |config|
|
|
219
|
-
config.
|
|
245
|
+
config.before :command do |cmd|
|
|
220
246
|
set_env('JRUBY_OPTS', "-X-C #{ENV['JRUBY_OPTS']}") # disable JIT since these processes are so short lived
|
|
221
247
|
set_env('JAVA_OPTS', "-d32 #{ENV['JAVA_OPTS']}") # force jRuby to use client JVM for faster startup times
|
|
222
248
|
end
|
|
@@ -287,7 +313,7 @@ expand_path('%/song.mp3')
|
|
|
287
313
|
let(:path) { expand_path('%/song.mp3') }
|
|
288
314
|
|
|
289
315
|
before :each do
|
|
290
|
-
|
|
316
|
+
cd('.') { FileUtils.cp path, 'file.mp3' }
|
|
291
317
|
end
|
|
292
318
|
|
|
293
319
|
before :each do
|
data/Rakefile
CHANGED
|
@@ -23,8 +23,18 @@ RSpec::Core::RakeTask.new do |spec|
|
|
|
23
23
|
spec.rspec_opts = ['--color', '--format documentation']
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if RUBY_VERSION < '1.9'
|
|
27
|
+
begin
|
|
28
|
+
require 'rubocop/rake_task'
|
|
29
|
+
RuboCop::RakeTask.new
|
|
30
|
+
rescue LoadError
|
|
31
|
+
desc 'Stub task to make rake happy'
|
|
32
|
+
task(:rubocop) {}
|
|
33
|
+
end
|
|
34
|
+
else
|
|
35
|
+
require 'rubocop/rake_task'
|
|
36
|
+
RuboCop::RakeTask.new
|
|
37
|
+
end
|
|
28
38
|
|
|
29
39
|
desc "Run tests, both RSpec and Cucumber"
|
|
30
40
|
task :test => [ :rubocop, :spec, :cucumber, :cucumber_wip]
|
data/TODO.md
ADDED
data/aruba.gemspec
CHANGED
|
@@ -2,23 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = 'aruba'
|
|
5
|
-
s.version = '0.
|
|
6
|
-
s.authors = ["Aslak Hellesøy", "David Chelimsky", "Mike Sassak", "Matt Wynne"]
|
|
7
|
-
s.description = '
|
|
5
|
+
s.version = '0.8.0.pre'
|
|
6
|
+
s.authors = ["Aslak Hellesøy", "David Chelimsky", "Mike Sassak", "Matt Wynne", "Jarl Friis", "Dennis Günnewig"]
|
|
7
|
+
s.description = 'Extension for popular TDD and BDD frameworks like "Cucumber" and "RSpec" to make testing commandline applications meaningful, easy and fun.'
|
|
8
8
|
s.summary = "aruba-#{s.version}"
|
|
9
9
|
s.license = 'MIT'
|
|
10
10
|
s.email = 'cukes@googlegroups.com'
|
|
11
11
|
s.homepage = 'http://github.com/cucumber/aruba'
|
|
12
12
|
|
|
13
|
-
s.add_runtime_dependency 'cucumber', '
|
|
14
|
-
s.add_runtime_dependency 'childprocess', '
|
|
15
|
-
s.add_runtime_dependency 'rspec-expectations', '
|
|
13
|
+
s.add_runtime_dependency 'cucumber', '~> 1.3.19'
|
|
14
|
+
s.add_runtime_dependency 'childprocess', '~> 0.5.6'
|
|
15
|
+
s.add_runtime_dependency 'rspec-expectations', '~> 3.3'
|
|
16
|
+
s.add_runtime_dependency 'contracts', '~> 0.9'
|
|
16
17
|
|
|
17
18
|
s.add_development_dependency 'bundler', '~> 1.10.2'
|
|
18
19
|
|
|
19
20
|
s.rubygems_version = ">= 1.6.1"
|
|
20
|
-
|
|
21
|
-
s.post_install_message =
|
|
21
|
+
s.required_ruby_version = '>= 1.8.7'
|
|
22
|
+
s.post_install_message = <<-EOS
|
|
23
|
+
With aruba >= 1.0
|
|
24
|
+
* "ruby 1.8.7"-support is discontinued
|
|
25
|
+
* aruba requires "cucumber 2" for the feature steps. The rest of aruba should be usable by whatever testing framework you are using
|
|
26
|
+
* Overwriting methods for configuration is discontinued. You need to use `aruba.config.<variable>` or `Aruba.configure { |config| config.<variable>` instead
|
|
27
|
+
* "aruba/reporting" will be removed. Please use `@debug`-tag + `byebug`, `debugger`, `pry` to troubleshoot your feature tests
|
|
28
|
+
* Set environment variables will have only effect on `#run` and the like + `#with_environment { }`
|
|
29
|
+
* The process environment will be fully resetted between tests. Sharing state via ENV['VAR'] = 'shared state' between tests will not be possible anymore. Please make that obvious by using explicit steps or use the aruba API for that.
|
|
30
|
+
* There will be a major cleanup for command execution. There will be only `run` and `run_simple` left. `run_interactive` is replaced by `run`.
|
|
31
|
+
* Setting the root directory of aruba via method overwrite or configuration - this should be your project root directory where the test suite is run
|
|
32
|
+
EOS
|
|
22
33
|
|
|
23
34
|
s.files = `git ls-files`.split("\n")
|
|
24
35
|
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
data/cucumber.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%
|
|
2
2
|
java_version = (RUBY_DESCRIPTION.match(/.*?on.*?(1\.[\d]\..*? )/))[1] if defined?(JRUBY_VERSION)
|
|
3
3
|
|
|
4
|
-
std_opts = "--color --exclude features/fixtures"
|
|
4
|
+
std_opts = "--color --exclude features/fixtures --require features"
|
|
5
5
|
java_default_opts = "--tags ~@wip-jruby-java-1.6" if defined?(JRUBY_VERSION) && (java_version < '1.7.0')
|
|
6
6
|
java_wip_opts = "--tags @wip-jruby-java-1.6:3" if defined?(JRUBY_VERSION) && (java_version < '1.7.0')
|
|
7
7
|
%>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Feature: Change current working directory
|
|
2
|
+
|
|
3
|
+
If you need to run some code in a different directory you can use the `cd`
|
|
4
|
+
command. It comes in two flavors:
|
|
5
|
+
|
|
6
|
+
\* First can simply use `cd 'some-dir'`
|
|
7
|
+
\* Second can use the block notation `cd('some-dir') { Dir.getwd }`
|
|
8
|
+
|
|
9
|
+
If you chose to use the latter one, the result of your block is returned. The
|
|
10
|
+
current working directory is only changed for the code inside the block -
|
|
11
|
+
it's use is side effect free.
|
|
12
|
+
|
|
13
|
+
Background:
|
|
14
|
+
Given I use a fixture named "cli-app"
|
|
15
|
+
|
|
16
|
+
Scenario: Existing directory
|
|
17
|
+
Given a file named "spec/cd_spec.rb" with:
|
|
18
|
+
"""
|
|
19
|
+
require 'spec_helper'
|
|
20
|
+
|
|
21
|
+
RSpec.describe 'cd to directory', :type => :aruba do
|
|
22
|
+
before(:each) do
|
|
23
|
+
create_directory 'new_dir.d'
|
|
24
|
+
cd 'new_dir.d'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
before(:each) { run_simple 'pwd' }
|
|
28
|
+
|
|
29
|
+
it { expect(last_command.output).to include 'new_dir.d' }
|
|
30
|
+
end
|
|
31
|
+
"""
|
|
32
|
+
When I run `rspec`
|
|
33
|
+
Then the specs should all pass
|
|
34
|
+
|
|
35
|
+
Scenario: Non-Existing directory
|
|
36
|
+
Given a file named "spec/cd_spec.rb" with:
|
|
37
|
+
"""
|
|
38
|
+
require 'spec_helper'
|
|
39
|
+
|
|
40
|
+
RSpec.describe 'cd to directory', :type => :aruba do
|
|
41
|
+
before(:each) { cd 'new_dir.d' }
|
|
42
|
+
before(:each) { run_simple 'pwd' }
|
|
43
|
+
|
|
44
|
+
it { expect(last_command.output).to include 'new_dir.d' }
|
|
45
|
+
end
|
|
46
|
+
"""
|
|
47
|
+
When I run `rspec`
|
|
48
|
+
Then the specs should not pass
|
|
49
|
+
|
|
50
|
+
Scenario: With block in it-block
|
|
51
|
+
Given a file named "spec/cd_spec.rb" with:
|
|
52
|
+
"""
|
|
53
|
+
require 'spec_helper'
|
|
54
|
+
|
|
55
|
+
RSpec.describe 'cd to directory', :type => :aruba do
|
|
56
|
+
before(:each) do
|
|
57
|
+
create_directory 'new_dir.d/subdir.d'
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it do
|
|
61
|
+
cd('new_dir.d/subdir.d') { expect(Dir.getwd).to include 'new_dir.d/subdir.d' }
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
"""
|
|
65
|
+
When I run `rspec`
|
|
66
|
+
Then the specs should all pass
|
|
67
|
+
|
|
68
|
+
Scenario: With block in before-block
|
|
69
|
+
|
|
70
|
+
Running `cd` with a block does not change:
|
|
71
|
+
|
|
72
|
+
\* The current directory - `Dir.getwd`
|
|
73
|
+
\* Aruba's current directory
|
|
74
|
+
|
|
75
|
+
Given a file named "spec/cd_spec.rb" with:
|
|
76
|
+
"""
|
|
77
|
+
require 'spec_helper'
|
|
78
|
+
|
|
79
|
+
RSpec.describe 'cd to directory', :type => :aruba do
|
|
80
|
+
before(:each) do
|
|
81
|
+
create_directory 'new_dir.d/subdir.d'
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
before :each do
|
|
85
|
+
cd('new_dir.d/subdir.d') do
|
|
86
|
+
# you code
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it { expect(Dir.getwd).not_to include 'new_dir.d/subdir.d' }
|
|
91
|
+
it { expect(expand_path('.')).not_to include 'new_dir.d/subdir.d' }
|
|
92
|
+
end
|
|
93
|
+
"""
|
|
94
|
+
When I run `rspec`
|
|
95
|
+
Then the specs should all pass
|
|
96
|
+
|
|
97
|
+
Scenario: The result of the block is returned
|
|
98
|
+
|
|
99
|
+
If you need to run some code in a different directory, you can also use the
|
|
100
|
+
block-notation of `cd`.
|
|
101
|
+
|
|
102
|
+
Given a file named "spec/cd_spec.rb" with:
|
|
103
|
+
"""
|
|
104
|
+
require 'spec_helper'
|
|
105
|
+
|
|
106
|
+
RSpec.describe 'cd to directory', :type => :aruba do
|
|
107
|
+
before(:each) do
|
|
108
|
+
create_directory 'new_dir.d/subdir.d'
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
before :each do
|
|
112
|
+
@my_output = cd('new_dir.d/subdir.d') { Dir.getwd }
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it { expect(@my_output).to include 'new_dir.d/subdir.d' }
|
|
116
|
+
end
|
|
117
|
+
"""
|
|
118
|
+
When I run `rspec`
|
|
119
|
+
Then the specs should all pass
|