Module: Viewcumber::Cucumber010

Included in:
Viewcumber
Defined in:
lib/viewcumber.rb

Instance Method Summary collapse

Instance Method Details

#after_feature(feature) ⇒ Object

The JSON formatter adds the background as a feature element, we only want full scenarios so lets delete all with type ‘background’



45
46
47
48
49
50
51
52
# File 'lib/viewcumber.rb', line 45

def after_feature(feature)
  if @gf.gherkin_object['elements']
    @gf.gherkin_object['elements'].delete_if do |element|
      element['type'] == 'background'
    end
  end
  super(feature)
end

#after_step(step) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/viewcumber.rb', line 34

def after_step(step)
  additional_step_info = { 'html_file' => write_html_to_file(Viewcumber.last_step_html), 
                           'emails' => emails_for_step(step) }

  current_element = @gf.gherkin_object['elements'].last
  current_step = current_element['steps'].last
  current_step.merge!(additional_step_info)
end