Sha256: 198a5278f8f2c207af15b8a3bc5f67eff270ddd3962f5bbde10bade5fc733db4

Contents?: true

Size: 1.45 KB

Versions: 10

Compression:

Stored size: 1.45 KB

Contents

# frozen_string_literal: true

require File.expand_path('../../test_helper', File.dirname(__FILE__))

class HTMLFormatterTest < Minitest::Test
  def setup
    super
    @store = Coverband::Adapters::RedisStore.new(Coverband::Test.redis, redis_namespace: 'coverband_test')
  end

  test 'generate dynamic content hosted html report' do
    Coverband.configure do |config|
      config.store             = @store
      config.ignore            = ['notsomething.rb']
    end
    mock_file_hash
    @store.send(:save_report, basic_coverage_full_path)

    notice = nil
    base_path = '/coverage'
    filtered_report_files = Coverband::Reporters::Base.report(@store, {})
    html = Coverband::Utils::HTMLFormatter.new(filtered_report_files,
                                               base_path: base_path,
                                               notice: notice).format_dynamic_html!
    assert_match 'loading source data', html
  end

  test 'generate static HTML report file' do
    Coverband.configure do |config|
      config.store             = @store
      config.ignore            = ['notsomething.rb']
    end
    mock_file_hash
    @store.send(:save_report, basic_coverage_full_path)

    filtered_report_files = Coverband::Reporters::Base.report(@store, {})
    Coverband::Utils::HTMLFormatter.new(filtered_report_files).format_static_html!
    html = File.read("#{Coverband.configuration.root}/coverage/index.html")
    assert_match 'Coverage first seen', html
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
coverband-4.2.7 test/coverband/utils/html_formatter_test.rb
coverband-4.2.7.rc.1 test/coverband/utils/html_formatter_test.rb
coverband-4.2.6 test/coverband/utils/html_formatter_test.rb
coverband-4.2.5 test/coverband/utils/html_formatter_test.rb
coverband-4.2.5.rc.2 test/coverband/utils/html_formatter_test.rb
coverband-4.2.5.rc.1 test/coverband/utils/html_formatter_test.rb
coverband-4.2.4 test/coverband/utils/html_formatter_test.rb
coverband-4.2.4.rc.3 test/coverband/utils/html_formatter_test.rb
coverband-4.2.4.rc.2 test/coverband/utils/html_formatter_test.rb
coverband-4.2.4.rc.1 test/coverband/utils/html_formatter_test.rb