Class: Gitnesse::FeatureTransform

Inherits:
Object
  • Object
show all
Defined in:
lib/gitnesse/feature_transform.rb

Class Method Summary collapse

Class Method Details

.convert(feature) ⇒ Object

Converts a Cucumber feature into a Markdown string compatible with Github’s Wiki system

feature - Cucumber feature to convert to Markdown

Returns a string



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gitnesse/feature_transform.rb', line 10

def self.convert(feature)
  unless feature.scan(/^\s*?Feature\:(.+?)\n/).flatten.any?
    return <<-EOS.chomp
# Undefined Feature

This feature hasn't been added yet.
    EOS
  end

  title = feature.scan(/^\s*?Feature\:(.+?)\n/).flatten.first.lstrip.chomp

  <<-EOS.chomp
# #{title}

```gherkin
#{feature.chomp}
```
  EOS
end