Skip to content

Commit

Permalink
Adds support for integration testing
Browse files Browse the repository at this point in the history
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 4702c58 commit 739a71d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
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}
36 changes: 36 additions & 0 deletions spec/support/example_groups/integration_example_group.rb
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

0 comments on commit 739a71d

Please sign in to comment.