Sha256: 5b99b340e50966fb58a9fd212ed1e6bcc13ec09dd3f9f89a9a8c1b0cf2a88848

Contents?: true

Size: 995 Bytes

Versions: 25

Compression:

Stored size: 995 Bytes

Contents

# frozen_string_literal: true

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

class RackServerCheckTest < Minitest::Test
  test 'returns true when running in rack server' do
    caller_locations = ['blah/lib/rack/server.rb'].map { |path| OpenStruct.new(path: path, label: 'foo') }
    Kernel.expects(:caller_locations).returns(caller_locations)
    assert(Coverband::RackServerCheck.running?)
  end

  test 'returns false when not running in rack server' do
    caller_locations = ['blah/lib/sidekiq/worker.rb'].map { |path| OpenStruct.new(path: path, label: 'foo') }
    Kernel.expects(:caller_locations).returns(caller_locations)
    refute(Coverband::RackServerCheck.running?)
  end

  test 'returns true if running within a rails server' do
    caller_locations = [OpenStruct.new(path: '/lib/rails/commands/commands_tasks.rb', label: 'server')]
    Kernel.expects(:caller_locations).returns(caller_locations)
    assert(Coverband::RackServerCheck.running?)
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
coverband-4.2.7 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.7.rc.1 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.6 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.5 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.5.rc.2 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.5.rc.1 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.4 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.4.rc.3 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.4.rc.2 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.4.rc.1 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.3 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.3.rc.2 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.3.rc.1 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.2 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.2.rc.1 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.1 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.1.rc4 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.1.rc3 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.1.rc2 test/coverband/integrations/rack_server_check_test.rb
coverband-4.2.1.rc1 test/coverband/integrations/rack_server_check_test.rb