Class: Cucumber::Formatter::ListScenarioName

Inherits:
Object
  • Object
show all
Includes:
Console, Io
Defined in:
lib/cucumber/formatter/list_scenario_name.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step_mother, path_or_io, options) ⇒ ListScenarioName

Returns a new instance of ListScenarioName.



11
12
13
14
15
# File 'lib/cucumber/formatter/list_scenario_name.rb', line 11

def initialize(step_mother, path_or_io, options)
  @io = ensure_io(path_or_io, "list_tags")
  @all_features = {}
  @output_file_name = '/tmp/cucumber_runner.tmp'
end

Instance Attribute Details

#all_featuresObject

Returns the value of attribute all_features.



10
11
12
# File 'lib/cucumber/formatter/list_scenario_name.rb', line 10

def all_features
  @all_features
end

#output_file_nameObject

Returns the value of attribute output_file_name.



10
11
12
# File 'lib/cucumber/formatter/list_scenario_name.rb', line 10

def output_file_name
  @output_file_name
end

Instance Method Details

#after_features(features) ⇒ Object



31
32
33
34
35
# File 'lib/cucumber/formatter/list_scenario_name.rb', line 31

def after_features(features)

  self.marshale_names

end

#before_feature(feature) ⇒ Object



18
19
20
21
22
23
# File 'lib/cucumber/formatter/list_scenario_name.rb', line 18

def before_feature(feature)

  @feature_name = feature.short_name
  @all_features[@feature_name]=[]

end

#marshale_namesObject



46
47
48
49
50
51
52
53
# File 'lib/cucumber/formatter/list_scenario_name.rb', line 46

def marshale_names
  marshaled = Marshal.dump @all_features

  File.open(@output_file_name,'wb') do |f|
    f.write(marshaled)
  end

end


38
39
40
41
42
43
44
45
# File 'lib/cucumber/formatter/list_scenario_name.rb', line 38

def print_names

  @all_features.each {|key,value|
    @io.puts key
    value.each {|tag| @io.puts "\t\t"<< tag }
  }

end

#scenario_name(*arg) ⇒ Object



25
26
27
28
# File 'lib/cucumber/formatter/list_scenario_name.rb', line 25

def scenario_name(*arg)
  keyword, name, file_colon_line, source_indent = *arg
  @all_features[@feature_name]<< name
end