Sha256: e8d7879703f5948a6406b388c73ec1cb6711836b1e635485bce26ffb041bab9a

Contents?: true

Size: 1.34 KB

Versions: 22

Compression:

Stored size: 1.34 KB

Contents

require 'test_plugin_helper'

class ArfReportDashboardHelperTest < ActionView::TestCase
  include ArfReportDashboardHelper

  test 'should return breakdown chart data with custom colors as json' do
    categories = { :passed => 'passed', :failed => 'failed' }
    report = { :passed => 23, :failed => 24 }
    colors = { :passed => '#FFF', :failed => '#000' }
    res = breakdown_chart_data(categories, report, colors)
    assert_equal ["passed", 23, "#FFF"], res.first
    assert_equal ["failed", 24, "#000"], res.last
  end

  test 'should return breakdown chart data for donut as json' do
    res = donut_breakdown_chart_data(:passed => 4, :failed => 7, :othered => 5)
    assert_equal 3, res.size
    assert_include res, ["Passed", 4, ArfReportDashboardHelper::COLORS[:passed]]
    assert_include res, ["Failed", 7, ArfReportDashboardHelper::COLORS[:failed]]
    assert_include res, ["Other", 5, ArfReportDashboardHelper::COLORS[:othered]]
  end

  test 'should return data for report status chart' do
    res = arf_report_status_chart_data(:passed => 6, :failed => 7, :othered => 8)
    assert_equal "Number of Events", res[:yAxisLabel]
    assert_equal "Rule Results", res[:xAxisLabel]
    assert_equal 3, res[:data].size
    assert_include res[:data], [:passed, 6]
    assert_include res[:data], [:failed, 7]
    assert_include res[:data], [:othered, 8]
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
foreman_openscap-10.1.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-10.0.3 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-10.0.2 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-10.0.1 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-10.0.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-9.0.4 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-9.0.3 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-9.0.2 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-9.0.1 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-9.0.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-8.0.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-7.1.1 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-7.1.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-7.0.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-6.0.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-5.2.3 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-5.2.2 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-5.1.1 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-5.2.1 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-5.2.0 test/helpers/arf_report_dashboard_helper_test.rb