forked from aeolus-incubator/thor-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for integration testing
with aruba and rspec using custom example groups This prepares code for aeolus-incubator#35 and aeolus-incubator#36
- Loading branch information
Petr Blaho
committed
Feb 11, 2013
1 parent
e7b65db
commit 991889e
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Requires supporting ruby files with custom matchers and macros, etc, | ||
# in spec/support/ and its subdirectories. | ||
Dir[File.join("./spec/support/**/*.rb")].each {|f| require f} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require 'active_support/concern' | ||
require 'aruba/api' | ||
|
||
module IntegrationExampleGroup | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
metadata[:type] = :integration | ||
|
||
let(:executable) { "aeolus" } | ||
let(:command) { "" } | ||
let(:params) { "" } | ||
let(:cmd) { [ executable, command, params ].select{|s| !s.empty?}.join(' ') } | ||
|
||
before(:each) do | ||
run_simple(unescape(cmd), false) | ||
end | ||
|
||
subject do | ||
groups = example.example_group.ancestors.clone | ||
groups << example.example_group | ||
if groups.find{|g| g.metadata[:example_group][:description] == "stdout"} | ||
all_stdout | ||
elsif groups.find{|g| g.metadata[:example_group][:description] == "stderr"} | ||
all_stderr | ||
end | ||
end | ||
end | ||
|
||
RSpec.configure do |config| | ||
config.include Aruba::Api | ||
config.include self, | ||
:type => :integration, | ||
:example_group => { :file_path => %r(spec/integration) } | ||
end | ||
end |