Sha256: a4caff98c23f05a568067cd9f5d5315717e2ec2851bac8f5ed85076a02853898

Contents?: true

Size: 1.09 KB

Versions: 35

Compression:

Stored size: 1.09 KB

Contents

require 'cucumber/step_mother'

module Cucumber
  # Defines "global" methods that may be used in *_steps.rb files.
  module StepMethods
    # Each scenario will execute in the context of what the supplied block returns.
    def World(&proc)
      executor.register_world_proc(&proc)
    end

    def Before(&proc)
      executor.register_before_scenario_proc(&proc)
    end
    
    def After(&proc)
      executor.register_after_scenario_proc(&proc)
    end

    def AfterStep(&proc)
      executor.register_after_step_proc(&proc)
    end

    def Given(key, &proc)
      step_mother.register_step_proc(key, &proc)
    end

    def When(key, &proc)
      step_mother.register_step_proc(key, &proc)
    end

    def Then(key, &proc)
      step_mother.register_step_proc(key, &proc)
    end
    
    # Simple workaround for old skool steps
    def steps_for(*_)
      STDERR.puts "WARNING: In Cucumber the steps_for method is obsolete"
      yield
    end
    
    def step_mother #:nodoc:
      @step_mother ||= StepMother.new
    end
    
    def executor
      @executor ||= Executor.new(step_mother)
    end
  end
end

Version data entries

35 entries across 35 versions & 7 rubygems

Version Path
aslakhellesoy-cucumber-0.1.10 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.11 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.12 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.13.2 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.13.3 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.13 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.14.1 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.14.2 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.15 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.16.1 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.16.2 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.16.3 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.16.4 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.16 lib/cucumber/step_methods.rb
aslakhellesoy-cucumber-0.1.9 lib/cucumber/step_methods.rb
bts-cucumber-0.1.13.1 lib/cucumber/step_methods.rb
bts-cucumber-0.1.13.2 lib/cucumber/step_methods.rb
bts-cucumber-0.1.13.3 lib/cucumber/step_methods.rb
elight-cucumber-0.1.9 lib/cucumber/step_methods.rb
jeffrafter-cucumber-0.1.10 lib/cucumber/step_methods.rb