module Journeyman::Integration

Internal: Integrations with testing frameworks.

Public Instance Methods

setup_integration(env, framework) click to toggle source

Internal: Sets up the integration with the framework being used.

# File lib/journeyman/integration.rb, line 7
def setup_integration(env, framework)
  case framework
  when :rspec then setup_rspec_integration(env)
  when :cucumber then setup_cucumber_integration(env)
  else setup_default_integration(env)
  end
end

Private Instance Methods

setup_cucumber_integration(cucumber) click to toggle source

Internal: Attaches Journeyman to the Cucumber context, and adds the helpers.

# File lib/journeyman/integration.rb, line 33
def setup_cucumber_integration(cucumber)
  cucumber.World(@helpers)
  cucumber.Before { Journeyman.attach(self) }
end
setup_default_integration(env) click to toggle source

Internal: Sets up the default integration, which is helpful for console and mock scripts.

# File lib/journeyman/integration.rb, line 19
def setup_default_integration(env)
  env.send :include, @helpers
  Journeyman.attach(env)
end
setup_rspec_integration(env) click to toggle source

Internal: Attaches Journeyman to the RSpec context, and adds the helpers.

# File lib/journeyman/integration.rb, line 25
def setup_rspec_integration(env)
  RSpec.configure do |config|
    config.include @helpers
    config.before(:each) { Journeyman.attach(self) }
  end
end