Skip to content

Instantly share code, notes, and snippets.

@carlosantoniodasilva
Created February 15, 2012 22:59
Show Gist options
  • Save carlosantoniodasilva/1839841 to your computer and use it in GitHub Desktop.
Save carlosantoniodasilva/1839841 to your computer and use it in GitHub Desktop.
RSpec - Register Example Group
module Support
module WorkerExampleGroup
include RSpec::Rails::RailsExampleGroup
def self.included(base)
base.metadata[:type] = :worker
end
end
end
RSpec.configure do |config|
config.include Support::WorkerExampleGroup, :type => :worker,
:example_group => { :file_path => config.escaped_path(%w[spec workers]) }
end
@carlosantoniodasilva
Copy link
Author

I'm adding a spec/workers dir for specific worker specs, which are mainly supposed to deal with background jobs, and I want to be able to include some shared helpers to them using config.include Support::MyHelpers, type: :worker. I based this code on rspec-rails example groups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment