Sha256: 4c9197a3438bbbef552ce384f40ce46a2ebbabdb31ad509e81266ec311f3d0f4
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
# frozen_string_literal: true require File.expand_path('../test_helper', File.dirname(__FILE__)) require 'rack' class FullStackTest < Minitest::Test BASE_KEY = Coverband::Adapters::RedisStore::BASE_KEY TEST_RACK_APP = '../fake_app/basic_rack.rb' def setup Coverband::Collectors::Coverage.instance.reset_instance Coverband.configure do |config| config.reporting_frequency = 100.0 config.store = Coverband::Adapters::RedisStore.new(Redis.new) config.s3_bucket = nil config.background_reporting_enabled = false end Coverband.configuration.store.clear! Coverband.start @rack_file = File.expand_path(TEST_RACK_APP, File.dirname(__FILE__)) require @rack_file end test 'call app' do request = Rack::MockRequest.env_for('/anything.json') middleware = Coverband::Middleware.new(fake_app_with_lines) results = middleware.call(request) assert_equal 'Hello Rack!', results.last expected = [nil, nil, 1, nil, 1, 1, 1, nil, nil] assert_equal expected, Coverband.configuration.store.coverage[@rack_file] # additional calls increase count by 1 middleware.call(request) expected = [nil, nil, 1, nil, 1, 1, 2, nil, nil] assert_equal expected, Coverband.configuration.store.coverage[@rack_file] # expected = nil # TODO: read the html to test it matches expectations? or return data as a hash? # actual = Coverband::Reporters::HTMLReport.report(Coverband.configuration.store, open_report: false) # assert_equal expected, actual end private def fake_app_with_lines @fake_app_with_lines ||= ::HelloWorld.new end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coverband-4.0.1.beta | test/unit/full_stack_test.rb |