Class: Cucumber::CompatibilityKit

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/compatibility_kit.rb

Overview

CompatibilityKit contains a series of helper methods to determine paths for each relevant item(s)

Class Method Summary collapse

Class Method Details

.feature_code_for(example_name) ⇒ Object

Return the path for a specific example scenario based on its name

i.e. 'attachments' would return the fully qualified path to the attachments folder which contains the feature, the ndjson file and any applicable assets to run the example

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
# File 'lib/cucumber/compatibility_kit.rb', line 11

def feature_code_for(example_name)
  path = File.join(cck_features_folder_location, example_name)

  return path if File.directory?(path)

  raise ArgumentError, "No feature code directory found in gem for CCK example: #{example_name}"
end

.gherkinObject

Return the paths for each example that is of 'gherkin' type



20
21
22
23
24
25
26
# File 'lib/cucumber/compatibility_kit.rb', line 20

def gherkin
  Dir.entries(cck_features_folder_location).select do |file_or_folder|
    next if file_or_folder.start_with?('.')

    gherkin_example?(File.join(cck_features_folder_location, file_or_folder))
  end
end

.markdownObject

Return the paths for each example that is of 'markdown' type NB: At the moment this (1 example - 'markdown'), isn't compatible with cucumber-ruby



30
31
32
33
34
35
36
# File 'lib/cucumber/compatibility_kit.rb', line 30

def markdown
  Dir.entries(cck_features_folder_location).select do |file_or_folder|
    next if file_or_folder.start_with?('.')

    markdown_example?(File.join(cck_features_folder_location, file_or_folder))
  end
end