aruba 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +56 -2
  3. data/appveyor.yml +32 -0
  4. data/aruba.gemspec +5 -23
  5. data/features/api/core/expand_path.feature +72 -0
  6. data/features/configuration/fixtures_directories.feature +8 -1
  7. data/features/configuration/home_directory.feature +81 -0
  8. data/features/fixtures/empty-app/.gitignore +9 -0
  9. data/features/fixtures/empty-app/.rspec +2 -0
  10. data/features/fixtures/empty-app/README.md +34 -0
  11. data/features/fixtures/empty-app/Rakefile +1 -0
  12. data/features/fixtures/empty-app/bin/cli +6 -0
  13. data/features/fixtures/empty-app/cli-app.gemspec +26 -0
  14. data/features/fixtures/empty-app/lib/cli/app.rb +13 -0
  15. data/features/fixtures/empty-app/lib/cli/app/version.rb +5 -0
  16. data/features/fixtures/empty-app/script/console +14 -0
  17. data/features/fixtures/empty-app/spec/spec_helper.rb +9 -0
  18. data/features/integration/rspec/getting_started.feature +148 -0
  19. data/features/step_definitions/aruba_dev_steps.rb +7 -6
  20. data/features/steps/environment/home_variable.feature +21 -8
  21. data/features/support/aruba.rb +2 -1
  22. data/lib/aruba/announcer.rb +83 -19
  23. data/lib/aruba/api.rb +6 -1
  24. data/lib/aruba/api/command.rb +15 -5
  25. data/lib/aruba/api/core.rb +8 -6
  26. data/lib/aruba/api/environment.rb +4 -2
  27. data/lib/aruba/config.rb +20 -3
  28. data/lib/aruba/contracts/absolute_path.rb +13 -0
  29. data/lib/aruba/cucumber.rb +8 -0
  30. data/lib/aruba/cucumber/hooks.rb +33 -18
  31. data/lib/aruba/matchers/environment.rb +1 -0
  32. data/lib/aruba/process_monitor.rb +1 -1
  33. data/lib/aruba/rspec.rb +42 -26
  34. data/lib/aruba/version.rb +3 -0
  35. data/script/test +1 -1
  36. metadata +34 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ddc643d39454c47f130a2fa2cb2dad9f72188ae
4
- data.tar.gz: 980ee237ac1bcf7d419cbade5f1878676ec6285e
3
+ metadata.gz: 5922faa25f8f714ff4c1e464ef17fd92cb75fb67
4
+ data.tar.gz: a0267059c8ec8d97fef445b546ba347bfab4e403
5
5
  SHA512:
6
- metadata.gz: 3237df9ea71f9850509bbda1b4ce5b0fc7288b27f1bf25208ef57acbe45e32c554bbaa4544f76d8e420079a925a16ea0030c0a14fd19803409c670917e1506a7
7
- data.tar.gz: 34a42f1c3cad83773d435eafc15c828089104991e1e331a0ba221ddd378569cf3888ae49a61316054e5917df26f62f5986e9e6310129aa5e2cee36509c86bbd2
6
+ metadata.gz: 47bca34dca99c9f86f36412ec3c1e915f233abaf7daa14b37149c6ee3b3b458745045a6fb3b8b260a78756b2ca1547f66a4bc6df502872633227b5e1a20dee2b
7
+ data.tar.gz: 96434347a767b0527cbd44a92946a63216a87f67d34ba1e19bac1fc27297256bc5496a7b7f9f4cadf31d9a59ec585edb22943c2f70ed0f22c2888e952b9649ac
data/History.md CHANGED
@@ -1,11 +1,27 @@
1
- ## [v0.8.0.pre4](https://github.com/cucumber/aruba/compare/v0.8.0.pre4...v0.8.0.pre5)
1
+ # Latest Release
2
+
3
+ ## [v0.8.1](https://github.com/cucumber/aruba/compare/v0.8.0...v0.8.1)
4
+
5
+ * Fix problem if working directory of aruba does not exist (issue #286)
6
+ * Re-Add removed method only_processes
7
+ * Fixed problem with last exit status
8
+ * Added appveyor to run tests of aruba on Windows (issue #287)
9
+ * Added new announcer which outputs full environment before command is run
10
+
11
+ # Old releases
12
+
13
+ ## [v0.8.0](https://github.com/cucumber/aruba/compare/v0.8.0.pre3...v0.8.0)
2
14
  * Build with cucumber 1.3.x on ruby 1.8.7, with cucumber 2.x on all other platforms
3
15
  * Fixed bugs in aruba's cucumber steps
4
16
  * Disable use of `win32/file`
17
+ * Fixed but in `in_current_dir*` not returning the result of the block
18
+ * Fixed checks for file content
19
+ * Fixed selectors for DebugProcess and InProcess to support sub-classes as well
20
+
5
21
 
6
22
  ## [v0.8.0.pre3](https://github.com/cucumber/aruba/compare/v0.8.0.pre2...v0.8.0.pre3)
7
23
  * Depend on cucumber 1.3.x for compatibility on ruby 1.8.7
8
- * Change PWD and OLDPW when `cd('path')` or `cd('path') {}` is used
24
+ * Change PWD and OLDPW when `cd('path') {}` is used within that block
9
25
  * Make nesting of `cd` possible
10
26
  * Make `run` inside `cd` possible
11
27
  * Fixed some bugs
@@ -325,3 +341,41 @@
325
341
  ## [v0.1.0](https://github.com/cucumber/aruba/compare/ed6a175d23aaff62dbf355706996f276f304ae8b...v0.1.1)
326
342
 
327
343
  * First release (David Chelimsky and Aslak Hellesøy)
344
+
345
+ # Upcoming un-released versions
346
+
347
+ ## [v0.9.0](https://github.com/cucumber/aruba/compare/v0.8.0...v0.9.0)
348
+ * Make the home directory configurable and use Around/around-hook to apply it
349
+ * Add announcer to output the full environment before a command is run
350
+ * Use prepend_environment_variable to modify PATH for rspec integration
351
+ * Add VERSION-constant to aruba and use it for code which should be activated on >= 1.0.0
352
+
353
+ ## [v1.0.0](https://github.com/cucumber/aruba/compare/v0.11.0...v1.0.0)
354
+
355
+ * "ruby 1.8.7"-support is discontinued.
356
+ * aruba requires "cucumber 2" for the feature steps. The rest of aruba should
357
+ be usable by whatever testing framework you are using.
358
+ * Overwriting methods for configuration is discontinued. You need to use
359
+ `aruba.config.<variable>` or `Aruba.configure { |config| config.<variable>`
360
+ instead.
361
+ * "aruba/reporting" will be removed. Please use `@debug`-tag + `byebug`,
362
+ `debugger`, `pry` to troubleshoot your feature tests.
363
+ * Set environment variables will have only effect on `#run` and the like +
364
+ `#with_environment { }`.
365
+ * The process environment will be fully resetted between tests. Sharing state
366
+ via ENV['VAR'] = 'shared state' between tests will not be possible anymore.
367
+ Please make that obvious by using explicit steps or use the aruba API for
368
+ that.
369
+ * There will be a major cleanup for command execution. There will be only
370
+ `run` and `run_simple` left. `run_interactive` is replaced by `run`.
371
+ * Setting the root directory of aruba via method overwrite or configuration -
372
+ this should be your project root directory where the test suite is run.
373
+ * The direct use of "InProcess", "DebugProcess" and "SpawnProcess" is not
374
+ supported anymore. You need to use "Command" instead. But be careful, it has
375
+ a different API.
376
+ * HOME can be configured via `Aruba.configure {}` and defaults to
377
+ `File.join(aruba.config.root_directory, aruba.config.working_directory?)`
378
+ if `aruba/cucumber` or `aruba/rspec` is used.
379
+ * Use different working directories based on test suite - RSpec, Cucumber.
380
+ It's `tmp/rspec` and `tmp/cucumber` now to make sure they do not overwrite
381
+ the test results from each other.
@@ -0,0 +1,32 @@
1
+ version: "{build}"
2
+
3
+ # This will build all PRs targetting matching branches.
4
+ # Without this, each PR builds twice -- once for the PR branch HEAD,
5
+ # and once for the merge commit that github creates for each mergable PR.
6
+ branches:
7
+ only:
8
+ - master
9
+
10
+ # Disable normal Windows builds in favor of our test script.
11
+ build: off
12
+
13
+ install:
14
+ - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
15
+ - ruby --version
16
+ - gem --version
17
+ - gem install bundler
18
+ - bundler --version
19
+ - bundle install
20
+ - cinst ansicon
21
+
22
+ test_script:
23
+ - bundle exec rake test --trace
24
+
25
+ environment:
26
+ matrix:
27
+ - ruby_version: '18'
28
+ - ruby_version: '19'
29
+ - ruby_version: '20'
30
+ - ruby_version: '21'
31
+ - ruby_version: '22'
32
+
@@ -1,8 +1,11 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ lib = ::File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'aruba/version'
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = 'aruba'
5
- s.version = '0.8.0'
8
+ s.version = Aruba::VERSION
6
9
  s.authors = ["Aslak Hellesøy", "David Chelimsky", "Mike Sassak", "Matt Wynne", "Jarl Friis", "Dennis Günnewig"]
7
10
  s.description = 'Extension for popular TDD and BDD frameworks like "Cucumber" and "RSpec" to make testing commandline applications meaningful, easy and fun.'
8
11
  s.summary = "aruba-#{s.version}"
@@ -26,28 +29,7 @@ Use on ruby 1.8.7
26
29
 
27
30
  gem 'cucumber', ~> '1.3.20'
28
31
 
29
- With aruba >= 1.0
30
- * "ruby 1.8.7"-support is discontinued.
31
- * aruba requires "cucumber 2" for the feature steps. The rest of aruba should
32
- be usable by whatever testing framework you are using.
33
- * Overwriting methods for configuration is discontinued. You need to use
34
- `aruba.config.<variable>` or `Aruba.configure { |config| config.<variable>`
35
- instead.
36
- * "aruba/reporting" will be removed. Please use `@debug`-tag + `byebug`,
37
- `debugger`, `pry` to troubleshoot your feature tests.
38
- * Set environment variables will have only effect on `#run` and the like +
39
- `#with_environment { }`.
40
- * The process environment will be fully resetted between tests. Sharing state
41
- via ENV['VAR'] = 'shared state' between tests will not be possible anymore.
42
- Please make that obvious by using explicit steps or use the aruba API for
43
- that.
44
- * There will be a major cleanup for command execution. There will be only
45
- `run` and `run_simple` left. `run_interactive` is replaced by `run`.
46
- * Setting the root directory of aruba via method overwrite or configuration -
47
- this should be your project root directory where the test suite is run.
48
- * The direct use of "InProcess", "DebugProcess" and "SpawnProcess" is not
49
- supported anymore. You need to use "Command" instead. But be careful, it has
50
- a different API.
32
+ With aruba >= 1.0 there will be breaking changes. Make sure to read https://github.com/cucumber/aruba/blob/master/History.md for 1.0.0
51
33
  EOS
52
34
 
53
35
  s.files = `git ls-files`.split("\n")
@@ -0,0 +1,72 @@
1
+ Feature: Expand paths with aruba
2
+
3
+ There are quite a few uses cases why you want to expand a path. `aruba` helps
4
+ you with this by providing you the `expand_path`-method. This method expands
5
+ paths relative to the `aruba.current_directory`-directory.
6
+
7
+ Background:
8
+ Given I use the fixture "cli-app"
9
+
10
+ Scenario: Use relative path
11
+ Given a file named "spec/expand_path_spec.rb" with:
12
+ """
13
+ require 'spec_helper'
14
+
15
+ RSpec.describe 'Expand path', :type => :aruba do
16
+ let(:path) { 'path/to/dir' }
17
+ it { expect(expand_path(path)).to eq File.join(aruba.root_directory, aruba.current_directory, path) }
18
+ end
19
+ """
20
+ When I run `rspec`
21
+ Then the specs should all pass
22
+
23
+ Scenario: Change directory using cd
24
+ Given a file named "spec/expand_path_spec.rb" with:
25
+ """
26
+ require 'spec_helper'
27
+
28
+ RSpec.describe 'Expand path', :type => :aruba do
29
+ let(:path) { 'path/to/dir' }
30
+ let(:directory) { 'dir1' }
31
+
32
+ before(:each) { create_directory(directory) }
33
+ before(:each) { cd(directory) }
34
+
35
+ it { expect(expand_path(path)).to eq File.join(aruba.root_directory, aruba.current_directory, path) }
36
+ end
37
+ """
38
+ When I run `rspec`
39
+ Then the specs should all pass
40
+
41
+ Scenario: Use ~ in path
42
+
43
+ Now this useses the HOME-variable from your normal shell HOME-variable.
44
+ From 1.0.0 on HOME will be `File.join(aruba.config.root_directory,
45
+ aruba.config.working_directory)`. If you want HOME have some other value,
46
+ you need to configure it explicitly via `Aruba.configure {}`.
47
+
48
+ Given a file named "spec/expand_path_spec.rb" with:
49
+ """
50
+ require 'spec_helper'
51
+
52
+ # Old before 1.0.0
53
+ RSpec.describe 'Expand path', :type => :aruba do
54
+ let(:path) { '~/path/to/dir' }
55
+
56
+ it { expect(expand_path(path)).to match %r</home/[^/]+/path/to/dir> }
57
+ end
58
+
59
+ # New from 1.0.0
60
+ RSpec.describe 'Expand path', :type => :aruba do
61
+ let(:path) { '~/path/to/dir' }
62
+
63
+ before(:each) do
64
+ set_environment_variable('HOME', File.join(aruba.config.root_directory, aruba.config.working_directory))
65
+ end
66
+
67
+ it { expect(expand_path(path)).to eq File.join(aruba.config.root_directory, aruba.config.working_directory, 'path/to/dir') }
68
+ end
69
+ """
70
+ When I run `rspec`
71
+ Then the specs should all pass
72
+
@@ -6,7 +6,6 @@ Feature: Configure directory where to look for fixtures
6
6
 
7
7
  Background:
8
8
  Given I use the fixture "cli-app"
9
- And the default feature-test
10
9
 
11
10
  Scenario: Default value
12
11
  Given a file named "features/support/aruba.rb" with:
@@ -27,5 +26,13 @@ Feature: Configure directory where to look for fixtures
27
26
  Aruba.configure do |config|
28
27
  config.fixtures_directories = %w(spec/fixtures)
29
28
  end
29
+
30
+ Aruba.configure do |config|
31
+ puts %(The default value is "%w(#{config.fixtures_directories.join(" ")})")
32
+ end
30
33
  """
31
34
  When I successfully run `cucumber`
35
+ Then the output should contain:
36
+ """
37
+ The default value is "%w(spec/fixtures)"
38
+ """
@@ -0,0 +1,81 @@
1
+ Feature: Configure the home directory to be used with aruba
2
+
3
+ As a developer
4
+ I want to configure the home directory
5
+ In order to have a better isolation of tests
6
+
7
+ Be careful to set the HOME-variable aka `config.home_directory` to something
8
+ else than `<project_root>/tmp/aruba`. This is a dance with the devil and
9
+ violates the isolation of your test suite. Thus will be not supported from
10
+ aruba as of 1.0.0.
11
+
12
+ Background:
13
+ Given I use the fixture "cli-app"
14
+ And the default feature-test
15
+
16
+ Scenario: Default value
17
+ Given a file named "features/support/aruba.rb" with:
18
+ """
19
+ Aruba.configure do |config|
20
+ puts %(The default value is "#{config.home_directory}")
21
+ end
22
+ """
23
+ When I successfully run `cucumber`
24
+ Then the output should contain:
25
+ """
26
+ The default value is "/home/
27
+ """
28
+
29
+ Scenario: Set to current working directory
30
+ Given a file named "features/support/aruba.rb" with:
31
+ """
32
+ Aruba.configure do |config|
33
+ # use current working directory
34
+ config.home_directory = '.'
35
+ end
36
+
37
+ Aruba.configure do |config|
38
+ puts %(The default value is "#{config.home_directory}")
39
+ end
40
+ """
41
+ Then I successfully run `cucumber`
42
+ Then the output should contain:
43
+ """
44
+ The default value is "."
45
+ """
46
+
47
+ Scenario: Set to aruba's working directory
48
+ Given a file named "features/support/aruba.rb" with:
49
+ """
50
+ Aruba.configure do |config|
51
+ # Use aruba working directory
52
+ config.home_directory = File.join(config.root_directory, config.working_directory)
53
+ end
54
+
55
+ Aruba.configure do |config|
56
+ puts %(The default value is "#{config.home_directory}")
57
+ end
58
+ """
59
+ Then I successfully run `cucumber`
60
+ Then the output should contain:
61
+ """
62
+ The default value is "/home/
63
+ """
64
+
65
+ Scenario: Set to some other path (deprecated)
66
+ Given a file named "features/support/aruba.rb" with:
67
+ """
68
+ Aruba.configure do |config|
69
+ # use current working directory
70
+ config.home_directory = '/tmp/home'
71
+ end
72
+
73
+ Aruba.configure do |config|
74
+ puts %(The default value is "#{config.home_directory}")
75
+ end
76
+ """
77
+ Then I successfully run `cucumber`
78
+ Then the output should contain:
79
+ """
80
+ The default value is "/tmp/home"
81
+ """
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,34 @@
1
+ # Simple Cli App
2
+
3
+ This is a simple test cli app
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'cli-app'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install cli-app
20
+
21
+ ## Usage
22
+
23
+ Place files in `lib/cli/app/`. They are loaded automatically. If you need a
24
+ specific load order, use `require` in your files.
25
+
26
+ ### CLI
27
+
28
+ ```
29
+ cli
30
+ ```
31
+
32
+ ### Library
33
+
34
+ You can use `script/console` to load your library.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH << File.expand_path('../../lib', __FILE__)
4
+ require 'cli/app'
5
+
6
+ exit 0
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cli/app/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cli-app'
8
+ spec.version = Cli::App::VERSION
9
+ spec.authors = ['Aruba Developers']
10
+ spec.email = 'cukes@googlegroups.com'
11
+
12
+ spec.summary = 'Summary'
13
+ spec.description = 'Description'
14
+ spec.homepage = 'http://example.com'
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.9'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ end
@@ -0,0 +1,13 @@
1
+ require 'cli/app/version'
2
+
3
+ if RUBY_VERSION < '1.9'
4
+ ::Dir.glob(::File.expand_path('../**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
5
+ else
6
+ ::Dir.glob(File.expand_path('../**/*.rb', __FILE__)).each { |f| require_relative f }
7
+ end
8
+
9
+ module Cli
10
+ module App
11
+ # Your code goes here...
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Cli
2
+ module App
3
+ VERSION = "0.1.0"
4
+ end
5
+ end