Sha256: 349bfe1ac111b483e3de3aa76053895e5e62656a0685f97a808bc5e831f19dbc

Contents?: true

Size: 956 Bytes

Versions: 4

Compression:

Stored size: 956 Bytes

Contents

module Cucumberator::Commands
  class Next
    class << self
      def perform(scenario, step_line, *args, &block)
        new(scenario, step_line).next_step
      end
    end

    def initialize(scenario, step_line)
      @scenario, @step_line = scenario, step_line
      @steps = Cucumberator::Steps.new(@scenario)
    end

    def next_step
      if next_step = detect_next_step
        puts next_step.backtrace_line
        @steps.current_visitor.visit_step(next_step)
        @step_line.set(next_step.file_colon_line.split(':').last.to_i)
        false
      else
        puts ":: Looks like it's the end of feature file. Happy coding! <3"
        true
      end
    end

    def detect_next_step
      next_step = nil

      @scenario.steps.each do |step|
        if step.status == :skipped and not step.backtrace_line["Then I will write new steps"]
          next_step = step
          break
        end
      end

      next_step
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cucumberator-1.0.3 lib/cucumberator/commands/next.rb
cucumberator-1.0.2 lib/cucumberator/commands/next.rb
cucumberator-1.0.1 lib/cucumberator/commands/next.rb
cucumberator-1.0.0 lib/cucumberator/commands/next.rb