class YARD::Handlers::Ruby::StepDefinitionHandler

Finds and processes all the step matchers defined in the source code.

To override the language you can define the step keywords in the YARD configuration file `~./yard/config`.

Public Class Methods

custom_step_definitions() click to toggle source
# File lib/yard/handlers/step_definition_handler.rb, line 10
def self.custom_step_definitions
  YARD::Config.options["yard-lucid"]["language"]["step_definitions"]
end
custom_step_definitions_defined?() click to toggle source
# File lib/yard/handlers/step_definition_handler.rb, line 14
def self.custom_step_definitions_defined?
  YARD::Config.options["yard-lucid"] and
  YARD::Config.options["yard-lucid"]["language"] and
  YARD::Config.options["yard-lucid"]["language"]["step_definitions"]
end
default_step_definitions() click to toggle source
# File lib/yard/handlers/step_definition_handler.rb, line 6
def self.default_step_definitions
  [ "Given", "When", "Then", "And", "But", "*" ]
end
generate_unique_id() click to toggle source
# File lib/yard/handlers/step_definition_handler.rb, line 64
def self.generate_unique_id
  @step_definition_count = @step_definition_count.to_i + 1
end
step_definitions() click to toggle source
# File lib/yard/handlers/step_definition_handler.rb, line 20
def self.step_definitions
  if custom_step_definitions_defined?
    custom_step_definitions
  else
    default_step_definitions
  end
end

Public Instance Methods

pending_command_statement?(line) click to toggle source
# File lib/yard/handlers/step_definition_handler.rb, line 47
def pending_command_statement?(line)
  (line.type == :command || line.type == :vcall) && line.first.source == pending_keyword
end
pending_keyword() click to toggle source
# File lib/yard/handlers/step_definition_handler.rb, line 43
def pending_keyword
  "pending"
end
pending_keyword_used?(block) click to toggle source
# File lib/yard/handlers/step_definition_handler.rb, line 51
def pending_keyword_used?(block)
  code_in_block = block.last
  code_in_block.find { |line| pending_command_statement?(line) }
end
step_definition_name() click to toggle source
# File lib/yard/handlers/step_definition_handler.rb, line 60
def step_definition_name
  "step_definition#{self.class.generate_unique_id}"
end
step_transform_namespace() click to toggle source
# File lib/yard/handlers/step_definition_handler.rb, line 56
def step_transform_namespace
  YARD::CodeObjects::Lucid::LUCID_STEPTRANSFORM_NAMESPACE
end