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



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

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

#walk_dataset(dataset) ⇒ Object



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

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

#walk_ifthen(it) ⇒ Object



59
60
61
62
63
# File 'lib/hiptest-publisher/render_context_maker.rb', line 59

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
# 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? => !item.find_sub_nodes(Hiptest::Nodes::Step).empty?,
    :is_empty? => item.children[:body].empty?
  }
end

#walk_parameter(p) ⇒ Object



65
66
67
68
69
# File 'lib/hiptest-publisher/render_context_maker.rb', line 65

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

#walk_scenario(scenario) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/hiptest-publisher/render_context_maker.rb', line 14

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



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

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

#walk_tag(t) ⇒ Object



71
72
73
74
75
# File 'lib/hiptest-publisher/render_context_maker.rb', line 71

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

#walk_template(t) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/hiptest-publisher/render_context_maker.rb', line 77

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



36
37
38
39
40
41
42
43
44
45
# File 'lib/hiptest-publisher/render_context_maker.rb', line 36

def walk_test(test)
  {
    :has_parameters? => false,
    :has_tags? => !test.children[:tags].empty?,
    :has_step? => !test.find_sub_nodes(Hiptest::Nodes::Step).empty?,
    :is_empty? => test.children[:body].empty?,
    :has_datasets? => false,
    :project_name => test.parent.parent.children[:name],
  }
end

#walk_tests(tests) ⇒ Object



47
48
49
50
51
# File 'lib/hiptest-publisher/render_context_maker.rb', line 47

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