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
jeffrafter-cucumber-0.1.12 lib/cucumber/step_methods.rb
kosmas58-cucumber-0.1.16.5 lib/cucumber/step_methods.rb
kosmas58-cucumber-0.1.16.6 lib/cucumber/step_methods.rb
cucumber-0.1.14 lib/cucumber/step_methods.rb
cucumber-0.1.13 lib/cucumber/step_methods.rb
cucumber-0.1.11 lib/cucumber/step_methods.rb
cucumber-0.1.12 lib/cucumber/step_methods.rb
cucumber-0.1.10 lib/cucumber/step_methods.rb
cucumber-0.1.8 lib/cucumber/step_methods.rb
cucumber-0.1.15 lib/cucumber/step_methods.rb
cucumber-0.1.16 lib/cucumber/step_methods.rb
cucumber-0.1.7 lib/cucumber/step_methods.rb
cucumber-0.1.9 lib/cucumber/step_methods.rb
mack-0.8.3.1 lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb
mack-0.8.3 lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb