Module: Hiptest::RenderContextMaker
- Included in:
- Renderer
- Defined in:
- lib/hiptest-publisher/render_context_maker.rb
Instance Method Summary collapse
- #walk_call(c) ⇒ Object
- #walk_dataset(dataset) ⇒ Object
- #walk_folder(folder) ⇒ Object
- #walk_ifthen(it) ⇒ Object
- #walk_item(item) ⇒ Object (also: #walk_actionword)
- #walk_parameter(p) ⇒ Object
- #walk_relative_item(item) ⇒ Object
- #walk_scenario(scenario) ⇒ Object
- #walk_scenarios(scenarios) ⇒ Object
- #walk_tag(t) ⇒ Object
- #walk_template(t) ⇒ Object
- #walk_test(test) ⇒ Object
- #walk_tests(tests) ⇒ Object
Instance Method Details
#walk_call(c) ⇒ Object
76 77 78 79 80 81 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 76 def walk_call(c) { :has_arguments? => !c.children[:arguments].empty?, :has_annotation? => !c.children[:annotation].nil? } end |
#walk_dataset(dataset) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 41 def walk_dataset(dataset) datatable = dataset.parent { :scenario_name => datatable.parent.children[:name] } end |
#walk_folder(folder) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 26 def walk_folder(folder) walk_relative_item(folder).merge( :self_name => folder.children[:name], :has_tags? => !folder.children[:tags].empty?, ) end |
#walk_ifthen(it) ⇒ Object
83 84 85 86 87 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 83 def walk_ifthen(it) { :has_else? => !it.children[:else].empty? } end |
#walk_item(item) ⇒ Object Also known as: walk_actionword
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 3 def walk_item(item) { :has_parameters? => !item.children[:parameters].empty?, :has_tags? => !item.children[:tags].empty?, :has_step? => has_step?(item), :is_empty? => item.children[:body].empty?, :declared_variables => item.declared_variables_names, :raw_parameter_names => item.children[:parameters].map {|p| p.children[:name] }, :self_name => item.children[:name], } end |
#walk_parameter(p) ⇒ Object
89 90 91 92 93 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 89 def walk_parameter(p) { :has_default_value? => !p.children[:default].nil? } end |
#walk_relative_item(item) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 15 def walk_relative_item(item) relative_package = @context.relative_path.split('/')[0...-1].join('.') relative_package = ".#{relative_package}" unless relative_package.empty? { :needs_to_import_actionwords? => @context.relative_path.count('/') > 0, :relative_package => relative_package, } end |
#walk_scenario(scenario) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 33 def walk_scenario(scenario) datatable = scenario.children[:datatable] walk_item(scenario).merge(walk_relative_item(scenario)).merge( :project_name => scenario.parent.parent.children[:name], :has_datasets? => datatable ? !datatable.children[:datasets].empty? : false ) end |
#walk_scenarios(scenarios) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 48 def walk_scenarios(scenarios) project = scenarios.parent { :project_name => project.children[:name], :self_name => project.children[:name], } end |
#walk_tag(t) ⇒ Object
95 96 97 98 99 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 95 def walk_tag(t) { :has_value? => !t.children[:value].nil? } end |
#walk_template(t) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 101 def walk_template(t) treated = t.children[:chunks].map do |chunk| { :is_variable? => chunk.is_a?(Hiptest::Nodes::Variable), :raw => chunk } end variable_names = treated.map {|item| item[:raw].children[:name] if item[:is_variable?]}.compact { :treated_chunks => treated, :variable_names => variable_names } end |
#walk_test(test) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 56 def walk_test(test) { :has_parameters? => false, :has_tags? => !test.children[:tags].empty?, :has_step? => has_step?(test), :is_empty? => test.children[:body].empty?, :has_datasets? => false, :project_name => test.parent.parent.children[:name], :self_name => test.children[:name], } end |
#walk_tests(tests) ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/hiptest-publisher/render_context_maker.rb', line 68 def walk_tests(tests) project = tests.parent { :project_name => project.children[:name], :self_name => project.children[:name], } end |