Sha256: b472473e2cbcbba5875f02852b9dc7cac5bdcb0bfd8501139e91e41f6ce5f689

Contents?: true

Size: 995 Bytes

Versions: 49

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

49 entries across 49 versions & 1 rubygems

Version Path
coverband-6.1.4 test/coverband/integrations/rack_server_check_test.rb
coverband-6.1.3 test/coverband/integrations/rack_server_check_test.rb
coverband-6.1.2 test/coverband/integrations/rack_server_check_test.rb
coverband-6.1.2.rc.1 test/coverband/integrations/rack_server_check_test.rb
coverband-6.1.1 test/coverband/integrations/rack_server_check_test.rb
coverband-6.1.0 test/coverband/integrations/rack_server_check_test.rb
coverband-6.0.3.rc.4 test/coverband/integrations/rack_server_check_test.rb
coverband-6.0.3.rc.3 test/coverband/integrations/rack_server_check_test.rb
coverband-6.0.3.rc.2 test/coverband/integrations/rack_server_check_test.rb
coverband-6.0.3.rc.1 test/coverband/integrations/rack_server_check_test.rb
coverband-6.0.2 test/coverband/integrations/rack_server_check_test.rb
coverband-6.0.1 test/coverband/integrations/rack_server_check_test.rb
coverband-6.0.1.rc.1 test/coverband/integrations/rack_server_check_test.rb
coverband-6.0.0 test/coverband/integrations/rack_server_check_test.rb
coverband-5.2.6.rc.6 test/coverband/integrations/rack_server_check_test.rb
coverband-5.2.3.2 test/coverband/integrations/rack_server_check_test.rb
coverband-5.2.6.rc.5 test/coverband/integrations/rack_server_check_test.rb
coverband-5.2.3.1 test/coverband/integrations/rack_server_check_test.rb
coverband-5.2.6.rc.4 test/coverband/integrations/rack_server_check_test.rb
coverband-5.2.6.rc.3 test/coverband/integrations/rack_server_check_test.rb