Module: Hiptest::RenderContextMaker

Included in:
Renderer
Defined in:
lib/hiptest-publisher/render_context_maker.rb

Instance Method Summary collapse

Instance Method Details

#walk_call(c) ⇒ Object



61
62
63
64
65
66
# File 'lib/hiptest-publisher/render_context_maker.rb', line 61

def walk_call(c)
  {
    :has_arguments? => !c.children[:arguments].empty?,
    :has_annotation? => !c.children[:annotation].nil?
  }
end

#walk_dataset(dataset) ⇒ Object



31
32
33
34
35
36
# File 'lib/hiptest-publisher/render_context_maker.rb', line 31

def walk_dataset(dataset)
  datatable = dataset.parent
  {
    :scenario_name => datatable.parent.children[:name]
  }
end

#walk_folder(folder) ⇒ Object



3
4
5
6
7
# File 'lib/hiptest-publisher/render_context_maker.rb', line 3

def walk_folder(folder)
  {
    :has_tags? => !folder.children[:tags].empty?
  }
end

#walk_ifthen(it) ⇒ Object



68
69
70
71
72
# File 'lib/hiptest-publisher/render_context_maker.rb', line 68

def walk_ifthen(it)
  {
    :has_else? => !it.children[:else].empty?
  }
end

#walk_item(item) ⇒ Object Also known as: walk_actionword



9
10
11
12
13
14
15
16
17
18
# File 'lib/hiptest-publisher/render_context_maker.rb', line 9

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] }
  }
end

#walk_parameter(p) ⇒ Object



74
75
76
77
78
# File 'lib/hiptest-publisher/render_context_maker.rb', line 74

def walk_parameter(p)
  {
    :has_default_value? => !p.children[:default].nil?
  }
end

#walk_scenario(scenario) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/hiptest-publisher/render_context_maker.rb', line 22

def walk_scenario(scenario)
  base = walk_item(scenario)
  base[:project_name] = scenario.parent.parent.children[:name]

  datatable = scenario.children[:datatable]
  base[:has_datasets?] = datatable ? !datatable.children[:datasets].empty? : false
  return base
end

#walk_scenarios(scenarios) ⇒ Object



38
39
40
41
42
# File 'lib/hiptest-publisher/render_context_maker.rb', line 38

def walk_scenarios(scenarios)
  {
    :project_name => scenarios.parent.children[:name]
  }
end

#walk_tag(t) ⇒ Object



80
81
82
83
84
# File 'lib/hiptest-publisher/render_context_maker.rb', line 80

def walk_tag(t)
  {
    :has_value? => !t.children[:value].nil?
  }
end

#walk_template(t) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/hiptest-publisher/render_context_maker.rb', line 86

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



44
45
46
47
48
49
50
51
52
53
# File 'lib/hiptest-publisher/render_context_maker.rb', line 44

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],
  }
end

#walk_tests(tests) ⇒ Object



55
56
57
58
59
# File 'lib/hiptest-publisher/render_context_maker.rb', line 55

def walk_tests(tests)
  {
    :project_name => tests.parent.children[:name]
  }
end