Class: VisibleCukes

Inherits:
Cucumber::Formatter::Html
  • Object
show all
Defined in:
lib/visible_cukes.rb

Instance Method Summary collapse

Constructor Details

#initialize(step_mother, io, options) ⇒ VisibleCukes

Returns a new instance of VisibleCukes.



4
5
6
7
8
9
10
11
# File 'lib/visible_cukes.rb', line 4

def initialize(step_mother, io, options)
  super(step_mother, io, options)
  raise "You must specify --out FILE for visible-cukes" unless File === io

  FileUtils.makedirs('./visible-cukes/pages')

  @rb = step_mother.load_programming_language('rb')
end

Instance Method Details

#visit_feature_name(name) ⇒ Object



13
14
15
16
17
# File 'lib/visible_cukes.rb', line 13

def visit_feature_name(name)
  super(name)
  @current_page_name_prefix = name.split(/\r?\n/)[0].downcase.gsub(/\s+/, '_').gsub(/[^a-z_]/, '')
  @current_page_name_count = 1
end

#visit_step(step) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/visible_cukes.rb', line 19

def visit_step(step)
  @step_id = step.dom_id
  html_filename = "pages/#{@current_page_name_prefix}_#{@current_page_name_count}.html"
  @current_page_name_count += 1
  @builder.a(:href => html_filename) do
    super
  end
  save_file html_filename
end