Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to an observer pattern to inform code about changes going on #259

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
85c90cd
Support for relish added
Jun 1, 2015
b28b97c
Ignore specs and features in simplecov
Jun 2, 2015
5e8d2fd
Support features in sub-directories
maxmeyer Jun 1, 2015
73127fa
Invoke examples randomly via rspec configuration
Jun 2, 2015
4a795c2
Move hooks to the correct file
Jun 2, 2015
0e31e61
Refactored configuration
Jun 2, 2015
7dfd111
Refactored hooks
Jun 1, 2015
aee7001
Move aruba configuration from api to configuration-class
Jun 1, 2015
072e0bb
Refactored jruby startup helper
Jun 1, 2015
7230c6e
Move root_directory configuration to configuration-class
Jun 2, 2015
6bd67eb
Move current_directory configuration to configuration-class
Jun 2, 2015
9125639
Replace fixtures path prefix through option
Jun 1, 2015
a25f6f0
Move configuration of exit timeout to configuration
Jun 1, 2015
5a7b96c
Move io timeout to configuration class
Jun 1, 2015
38f8ebd
Move fixtures directory to configuration class
Jun 2, 2015
be42bf2
Set aruba exception to StandardError to make sure @aruba_exceptions r…
maxmeyer Jun 1, 2015
a9acfb0
Refactored extensions for ruby core
maxmeyer Jun 1, 2015
d94ac1a
Introduce step to test run of cucumber with aruba
maxmeyer Jun 1, 2015
1ef1618
Added runtime config
Jun 2, 2015
da1b36d
Refactored tests for exit_status
Jun 2, 2015
a3bc311
Move some methods to core module
Jun 2, 2015
052bf57
Proper display of error messages on travis
Jun 2, 2015
5218af4
Added test for config wrapper
maxmeyer Jun 3, 2015
275799d
Fixed use of config wrapper
maxmeyer Jun 3, 2015
06e11fa
Workaround for missing announcer method
Jun 10, 2015
957efac
Rename process to command
Jun 2, 2015
8963e91
Introduce queue to handle events
Jun 2, 2015
f0d0d68
Refactor event queue
Jun 2, 2015
0d6722c
Refactored command monitor
maxmeyer Jun 3, 2015
a92032d
Next step
maxmeyer Jun 4, 2015
b7ccebf
Next 2
maxmeyer Jun 12, 2015
220c3f8
Don't spam the cukes list
aslakhellesoy Jun 12, 2015
9136a4f
Merge pull request #1 from aslakhellesoy/patch-1
maxmeyer Jun 13, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .nav
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
README.md
# before_cmd_hooks.feature
# command_environment_variables.feature
# configuration-rspec.feature
# custom_ruby_process.feature
# exit_statuses.feature
# file_system_commands.feature
# flushing.feature
# interactive.feature
# no_clobber.feature
# output.feature
# utf-8.feature
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--color
--order random
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Metrics/ModuleLength:
Metrics/AbcSize:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Lint/AmbiguousRegexpLiteral:
Enabled: false

Expand Down
2 changes: 2 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ SimpleCov.start unless ENV.key? 'ARUBA_NO_COVERAGE'
SimpleCov.configure do
# ignore this file
add_filter '.simplecov'
add_filter 'spec'
add_filter 'features'

# Rake tasks aren't tested with rspec
add_filter 'Rakefile'
Expand Down
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ rvm:
matrix:
allow_failures:
- rvm: rbx
notifications:
email:
- cukes-devs@googlegroups.com
irc:
- irc.freenode.org#cucumber
env:
global:
secure: l8uznA5K4K9mZ1krmP3lTMD8WcJ32qGxFOR3jubKHcOBSLB4xSzU2aIqjyJdO+rLzebkwamhJc8pGSIWOUDQYvFiX7splK+uEkbBJ5huAhXtLF4Qgl86bCWbEXYzN7rvn0DQfpJAovyFMNRMnfo70XhwqWzFsaYa7Z0YbqYsJE4=
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ group :development, :test do
gem 'rubocop', '~> 0.31.0'

gem 'license_finder', '~> 2.0.4'

gem 'relish'
end

platforms :rbx do
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ You can hook into Aruba's lifecycle just before it runs a command:

```ruby
Aruba.configure do |config|
config.before_cmd do |cmd|
config.before :cmd do |cmd|
puts "About to run '#{cmd}'"
end
end
Expand Down Expand Up @@ -216,7 +216,7 @@ or setting a hook like this example:

```ruby
Aruba.configure do |config|
config.before_cmd do |cmd|
config.before :cmd do |cmd|
set_env('JRUBY_OPTS', "-X-C #{ENV['JRUBY_OPTS']}") # disable JIT since these processes are so short lived
set_env('JAVA_OPTS', "-d32 #{ENV['JAVA_OPTS']}") # force jRuby to use client JVM for faster startup times
end
Expand Down
1 change: 1 addition & 0 deletions aruba.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'cucumber', '>= 1.1.1'
s.add_runtime_dependency 'childprocess', '>= 0.3.6'
s.add_runtime_dependency 'rspec-expectations', '>= 2.7.0'
s.add_runtime_dependency 'contracts', '~> 0.9'

s.add_development_dependency 'bundler', '~> 1.10.2'

Expand Down
2 changes: 1 addition & 1 deletion cucumber.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%
java_version = (RUBY_DESCRIPTION.match(/.*?on.*?(1\.[\d]\..*? )/))[1] if defined?(JRUBY_VERSION)

std_opts = "--color --exclude features/fixtures"
std_opts = "--color --exclude features/fixtures --require features"
java_default_opts = "--tags ~@wip-jruby-java-1.6" if defined?(JRUBY_VERSION) && (java_version < '1.7.0')
java_wip_opts = "--tags @wip-jruby-java-1.6:3" if defined?(JRUBY_VERSION) && (java_version < '1.7.0')
%>
Expand Down
136 changes: 136 additions & 0 deletions features/commands/exit_statuses.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
Feature: Check exit status of commands

Use the `the exit status should be \d`-step to check the exit status of the
last command which was executed.

Background:
Given I use a fixture named "cli-app"

Scenario: Test for exit status of 0
Given a file named "bin/cli" with:
"""
#!/usr/bin/env sh
exit 0
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Exit status
Scenario: Run command
When I run `cli`
Then the exit status should be 0
"""
When I run `cucumber`
Then the features should all pass

Scenario: Test for exit status 1
Given a file named "bin/cli" with:
"""
#!/usr/bin/env sh
exit 1
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
When I run `cli`
Then the exit status should be 1
"""
When I run `cucumber`
Then the features should all pass

Scenario: Test for non-zero exit status
Given a file named "bin/cli" with:
"""
#!/usr/bin/env sh
exit 1
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
When I run `cli`
Then the exit status should not be 0
"""
When I run `cucumber`
Then the features should all pass

Scenario: Successfully run something
Given a file named "bin/cli" with:
"""
#!/usr/bin/env sh
exit 0
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
When I successfully run `cli`
"""
When I run `cucumber`
Then the features should all pass

Scenario: Fail to run something successfully
Given a file named "bin/cli" with:
"""
#!/usr/bin/env sh
exit 1
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
When I successfully run `cli`
"""
When I run `cucumber`
Then the features should not all pass

Scenario: Overwrite the default exit timeout via step
Given a file named "bin/cli" with:
"""
#!/usr/bin/env sh
sleep 1
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
Given the default aruba timeout is 2 seconds
When I successfully run `cli`
"""
When I run `cucumber`
Then the features should all pass

Scenario: Successfully run something longer then the default time
Given a file named "bin/cli" with:
"""
#!/usr/bin/env sh
sleep 1
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
Given the default aruba timeout is 0 seconds
When I successfully run `cli` for up to 2 seconds
"""
When I run `cucumber`
Then the features should all pass

Scenario: Unsuccessfully run something that takes too long
Given a file named "bin/cli" with:
"""
#!/usr/bin/env sh
sleep 2
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
Given the default aruba timeout is 0 seconds
When I successfully run `cli` for up to 1 seconds
"""
When I run `cucumber`
Then the features should not all pass with:
"""
process still alive after 1 seconds
"""
32 changes: 32 additions & 0 deletions features/configuration/current_directory.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Feature: Configure current directory of aruba

As a developer
I want to configure the current directory of aruba
In order to have a test directory for each used spec runner - e.g. cucumber or rspec

Background:
Given I use the fixture "cli-app"
And the default feature-test

Scenario: Default value
Given a file named "features/support/aruba.rb" with:
"""
Aruba.configure do |config|
puts %(The default value is "%w(#{config.current_directory.join(" ")})")
end
"""
When I successfully run `cucumber`
Then the output should contain:
"""
The default value is "%w(tmp aruba)"
"""

Scenario: Modify value
Given a file named "features/support/aruba.rb" with:
"""
Aruba.configure do |config|
config.current_directory = %w(tmp cucumber)
end
"""
When I successfully run `cucumber`
Then a directory named "tmp/cucumber" should exist
49 changes: 49 additions & 0 deletions features/configuration/exit_timeout.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Feature: Configure timeout for command execution

As a developer
I want to configure the timeout when executing a command
In order to support some longer running commands

Background:
Given I use the fixture "cli-app"
And the default feature-test

Scenario: Default value
Given a file named "features/support/aruba.rb" with:
"""
Aruba.configure do |config|
puts %(The default value is "#{config.exit_timeout}")
end
"""
When I successfully run `cucumber`
Then the output should contain:
"""
The default value is "3"
"""

Scenario: Modify value
Given a file named "bin/cli" with:
"""
sleep 1
"""
And a file named "features/support/aruba.rb" with:
"""
Aruba.configure do |config|
config.exit_timeout = 2
end
"""
Then I successfully run `cucumber`

Scenario: Fails if takes longer
Given a file named "bin/cli" with:
"""
sleep 5
"""
And a file named "features/support/aruba.rb" with:
"""
Aruba.configure do |config|
config.exit_timeout = 1
end
"""
Then I run `cucumber`
And the exit status should be 1
31 changes: 31 additions & 0 deletions features/configuration/fixtures_directories.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Feature: Configure directory where to look for fixtures

As a developer
I want to configure the directory where aruba looks for fixtures
In order to use them in my tests

Background:
Given I use the fixture "cli-app"
And the default feature-test

Scenario: Default value
Given a file named "features/support/aruba.rb" with:
"""
Aruba.configure do |config|
puts %(The default value is "%w(#{config.fixtures_directories.join(" ")})")
end
"""
When I successfully run `cucumber`
Then the output should contain:
"""
The default value is "%w(features/fixtures spec/fixtures test/fixtures)"
"""

Scenario: Modify value
Given a file named "features/support/aruba.rb" with:
"""
Aruba.configure do |config|
config.fixtures_directories = %w(spec/fixtures)
end
"""
When I successfully run `cucumber`
5 changes: 5 additions & 0 deletions features/configuration/fixtures_directory.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Feature: Change fixtures directory search paths of aruba

As a developer
I want to use a different fixtures directory search path order directory for aruba
In order to look for fixtures in features/fixtures for cucumber and in spec/fixtures for rspec first
24 changes: 24 additions & 0 deletions features/configuration/fixtures_path_prefix.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Feature: Use fixtures path prefix of aruba

As a developer
I want to use the fixtures path prefix in aruba
In some API-method for using the fixtures path

Background:
Given I use the fixture "cli-app"
And the default feature-test

Scenario: Default value
Given a file named "features/support/aruba.rb" with:
"""
Aruba.configure do |config|
puts "The prefix is \"#{config.fixtures_path_prefix}\"."
end
"""
When I successfully run `cucumber`
Then the output should contain:
"""
The prefix is "%".
"""


Loading