Module: Cucumber::Tcl

Extended by:
Glue::Dsl
Defined in:
lib/cucumber/tcl.rb,
lib/cucumber/tcl/version.rb,
lib/cucumber/tcl/framework.rb,
lib/cucumber/tcl/data_table.rb,
lib/cucumber/tcl/activate_steps.rb,
lib/cucumber/tcl/step_definitions.rb

Defined Under Namespace

Classes: DataTable, Framework, StepDefinitions

Constant Summary collapse

VERSION =
'0.0.9'.freeze
ActivateSteps =
Cucumber::Core::Filter.new(:create_step_definitions) do
  def test_case(test_case)
    activated_steps = test_case.test_steps.map do |test_step|
      step_definitions.attempt_to_activate(test_step)
    end
    test_case.with_steps(activated_steps).describe_to receiver
    reset_step_definitons
  end

  private

  def reset_step_definitons
    @step_definitions = nil
  end

  def step_definitions
    @step_definitions ||= create_step_definitions.call
  end
end

Class Method Summary collapse

Class Method Details

.install(cucumber_config) ⇒ Object

We are running outside of a Cucumber test run (e.g., in RSpec). Safely ignore the plugin registration.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cucumber/tcl.rb', line 20

def self.install(cucumber_config)
  # Unless configured off, we should start up a new
  # framework for each scenario, which results
  # in a new TCL interpreter.  This can be used
  # to check that there is no data leakage between
  # scenarios when testing poorly understood code
  if ENV['SHARE_FRAMEWORK'] == '1'
    framework = Framework.new(cucumber_config)
    create_step_definitions = -> { StepDefinitions.new(framework) }
  else
    create_step_definitions = -> { StepDefinitions.new(Framework.new(cucumber_config)) }
  end
  cucumber_config.filters << ActivateSteps.new(create_step_definitions)
end