Sha256: b9d9f68767b77150b01212d8f05d752a5bdaf1e6acee390ac8e6638d1343ac15

Contents?: true

Size: 1.41 KB

Versions: 25

Compression:

Stored size: 1.41 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 = JSON.parse(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
    report = { :passed => 4, :failed => 7, :othered => 5 }
    res = JSON.parse(donut_breakdown_chart_data(report))
    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 = JSON.parse(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

25 entries across 25 versions & 1 rubygems

Version Path
foreman_openscap-4.3.3 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.3.2 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.3.1 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.3.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.1.3 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.0.6 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.2.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.0.5 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.1.2 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.1.1 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.1.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.0.4 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.0.3 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.0.2 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.0.1 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-3.0.1 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-4.0.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-3.0.0 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-2.0.2 test/helpers/arf_report_dashboard_helper_test.rb
foreman_openscap-1.0.10 test/helpers/arf_report_dashboard_helper_test.rb