Sha256: 755850428df2addd2a4b828ffaf18cbf2666b1de121e38a1da2d91a4bc7dd5ce
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true require File.expand_path("../../test_helper", File.dirname(__FILE__)) class BackgroundTest < Minitest::Test class ThreadDouble < Struct.new(:alive) def exit end def alive? alive end end def test_start Thread.expects(:new).yields.returns(ThreadDouble.new(true)) Coverband::Background.expects(:loop).yields Coverband::Background.expects(:sleep).with(30) Coverband::Collectors::Coverage.instance.expects(:report_coverage).once 2.times { Coverband::Background.start } end def test_start_with_wiggle Thread.expects(:new).yields.returns(ThreadDouble.new(true)) Coverband::Background.expects(:loop).yields Coverband::Background.expects(:sleep).with(35) Coverband::Background.expects(:rand).with(10).returns(5) Coverband.configuration.reporting_wiggle = 10 Coverband::Collectors::Coverage.instance.expects(:report_coverage).once 2.times { Coverband::Background.start } end def test_start_dead_thread Thread.expects(:new).yields.returns(ThreadDouble.new(false)).twice Coverband::Background.expects(:loop).yields.twice Coverband::Background.expects(:sleep).with(30).twice Coverband::Collectors::Coverage.instance.expects(:report_coverage).twice 2.times { Coverband::Background.start } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coverband-5.0.0.rc.3 | test/coverband/integrations/background_test.rb |