Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ExampleGroup helpers to create a dummy class.

  • Loading branch information...
commit d98f888f2b542426a2213d7bff9ee9ef379998cf 1 parent 68b4f57
@justinko justinko authored
Showing with 19 additions and 8 deletions.
  1. +8 −8 spec/spec_helper.rb
  2. +11 −0 spec/support/example_group_helpers.rb
View
16 spec/spec_helper.rb
@@ -1,17 +1,17 @@
require 'mutant'
require 'aruba/api'
+Dir['./spec/support/*.rb'].map {|f| require f }
+
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus
config.run_all_when_everything_filtered = true
- config.include Aruba::Api, :example_group => {
- :file_path => /spec\/functional/
- }
- config.before(:each, :example_group => {:file_path => /spec\/functional/}) do
- @aruba_timeout_seconds = 5
- end
- config.after(:each, :example_group => {:file_path => /spec\/functional/}) do
- FileUtils.remove_dir('tmp/aruba')
+ config.extend ExampleGroupHelpers
+
+ {:example_group => {:file_path => /spec\/functional/}}.tap do |options|
+ config.include Aruba::Api, options
+ config.before(:suite, options) { @aruba_timeout_seconds = 5 }
+ config.after(:each, options) { FileUtils.remove_dir('tmp/aruba') }
end
end
View
11 spec/support/example_group_helpers.rb
@@ -0,0 +1,11 @@
+module ExampleGroupHelpers
+ def setup_thing(&block)
+ before do
+ Object.const_set(:Thing, Class.new(&block))
+ end
+
+ after do
+ Object.send(:remove_const, :Thing) if Object.const_defined?(:Thing)
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.