ruby-qa/lib/rubyqa/templates.rb

41 lines
980 B
Ruby
Executable File

module RubyQA
module Template
require 'erb'
BASE_REPORT_TEMPLATE=ERB.new(<<ERB, trim_mode: '-')
RubyQA Test Report
QA Date: <%= Time.now.strftime("%Y/%m/%d %l:%M:%S %p %Z") %>
QA Runner: <%= ENV['USER'] %>
QA Tests: <%= Manager.tests.count %>
<% Manager.tests.each do |test| -%>
- "<%= test.name %>"
<% end -%>
QA Hosts:
<% Manager.hosts.each do |host| -%>
- <%= host.name %> (<%= host[:ip] %>)
<% end -%>
###############
# Tests Begin #
###############
<% Manager.tests.each do |test| -%>
<%= test.report %>
<% end -%>
ERB
BASE_TEST_TEMPLATE = ERB.new(<<EOF, :trim_mode => '-')
==============================================
Test : "<%= @name %>"
<%- if not @description.empty? -%>
Description : "<%= @description %>"
<% end -%>
==============================================
<% @tests.each do |hostname,data| -%>
<%= hostname %> : <%= data[:status] %> <% if data[:context].has_key? :note %> (<%= data[:context][:note] %>) <% end %>
<% end -%>
EOF
end
end