Sha256: 4867b6c3acb7f8d6cdcf4ae5c98aa6b5e13d53a508a799efc73ad8ff7d123a7c
Contents?: true
Size: 848 Bytes
Versions: 16
Compression:
Stored size: 848 Bytes
Contents
require File.expand_path('../step_definition_file', __FILE__) class StepManager STEP_KINDS = %w[Given When Then] attr_accessor :directories, :step_files def initialize(*directories) self.directories = directories self.step_files = directories.map(&method(:collect_files)).flatten.compact end def to_markdown step_files.collect(&:to_markdown).join "\n\n" end def steps(search = nil) step_files.collect(&:real_steps).flatten. sort_by { |step| [STEP_KINDS.index(step.kind), step.to_s.downcase] }. select { |definition| search.nil? || definition.matches_search?(search) } end private def collect_files(directory) Dir["#{directory}/**/*_steps.rb"].to_a.sort.map do |filename| next if filename.include? 'spreewald/all_steps' StepDefinitionFile.new(filename) end.compact end end
Version data entries
16 entries across 16 versions & 1 rubygems