Sha256: bfdb9108d6cc281e7bbfc114511273207e155d12b4ad1e9aa7a701949ffc0801

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 KB

Contents

module Cucumber
  class StepMatch
    attr_reader :step_definition, :args

    def initialize(step_definition, step_name, formatted_step_name, args)
      @step_definition, @step_name, @formatted_step_name, @args = step_definition, step_name, formatted_step_name, args
    end

    def name
      @formatted_step_name
    end

    def invoke(world, multiline_arg)
      all_args = @args.dup
      all_args << multiline_arg if multiline_arg
      @step_definition.invoke(world, all_args)
    end

    def format_args(format = lambda{|a| a})
      @formatted_step_name || @step_definition.format_args(@step_name, format)
    end
    
    def file_colon_line
      @step_definition.file_colon_line
    end

    def backtrace_line
      @step_definition.backtrace_line
    end

    def text_length
      @step_definition.text_length
    end
  end
  
  class NoStepMatch
    attr_reader :step_definition

    def initialize(step, name)
      @step = step
      @name = name
    end
    
    def format_args(format)
      @name
    end

    def file_colon_line
      raise "No file:line for #{@step}" unless @step.file_colon_line
      @step.file_colon_line
    end

    def backtrace_line
      @step.backtrace_line
    end

    def text_length
      @step.text_length
    end
  end
end

Version data entries

18 entries across 18 versions & 6 rubygems

Version Path
aslakhellesoy-cucumber-0.3.10 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.11.1 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.11.3 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.11.5 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.11.6 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.11 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.9.4 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.9.5 lib/cucumber/step_match.rb
jwilger-cucumber-0.3.11.200906161550 lib/cucumber/step_match.rb
jwilger-cucumber-0.3.11.200907091518 lib/cucumber/step_match.rb
kosmas58-cucumber-0.3.11.3 lib/cucumber/step_match.rb
kosmas58-cucumber-0.3.11.6 lib/cucumber/step_match.rb
kosmas58-cucumber-0.3.9.4 lib/cucumber/step_match.rb
square-cucumber-0.3.12.2 lib/cucumber/step_match.rb
squirrel-cucumber-0.3.12.1 lib/cucumber/step_match.rb
squirrel-cucumber-0.3.12 lib/cucumber/step_match.rb
cucumber-0.3.10 lib/cucumber/step_match.rb
cucumber-0.3.11 lib/cucumber/step_match.rb