Sha256: 8edeca8c848bf571790e4e82be8c51f440a15d59ec5daaa0e558bc5a774c1156

Contents?: true

Size: 1.21 KB

Versions: 40

Compression:

Stored size: 1.21 KB

Contents

module Cucumber
  class StepMatch
    attr_reader :step_definition
    attr_reader :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 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)
      @step = step
    end
    
    def format_args(format)
      @step.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

40 entries across 40 versions & 5 rubygems

Version Path
aslakhellesoy-cucumber-0.2.0.3 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.2.0.4 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.2.1 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.2.2.1 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.2.2.2 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.2.2 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.2.3.1 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.2.3.2 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.2.3.3 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.2.3.4 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.2.3 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.0.1 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.0 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.1.1 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.1 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.2 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.3.1 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.3.2 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.3.3 lib/cucumber/step_match.rb
aslakhellesoy-cucumber-0.3.3.4 lib/cucumber/step_match.rb