Sha256: 65616c09c9afb376b3d3c4927d9ab0e65d60241e6e4f2d91dfc489feb1d6c960

Contents?: true

Size: 1.25 KB

Versions: 19

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require File.expand_path("../rails_test_helper", File.dirname(__FILE__))

class RailsRoutesWithoutConfigStackTest < Minitest::Test
  def setup
    super
    setup_server
  end

  def teardown
    super
    shutdown_server
  end

  test "check route tracker" do
    output = `sleep 7 && curl http://localhost:9999/dummy_view/show`
    assert output.match(/rendered view/)
    assert output.match(/I am no dummy view tracker text/)
    output = `sleep 2 && curl http://localhost:9999/coverage/routes_tracker`
    assert output.match(/Used Routes: \(1\)/)
    assert output.match(/dummy_view\/show/)
    assert output.match(/GET/)
  end

  private

  # NOTE: We aren't leveraging Capybara because it loads all of our other test helpers and such,
  # which in turn Configures coverband making it impossible to test the configuration error
  def setup_server
    ENV["RAILS_ENV"] = "test"
    require "rails"
    fork do
      exec "cd test/rails#{Rails::VERSION::MAJOR}_dummy && COVERBAND_TEST=test bundle exec rackup config.ru -p 9999 --pid /tmp/testrack.pid"
    end
  end

  def shutdown_server
    if File.exist?("/tmp/testrack.pid")
      pid = `cat /tmp/testrack.pid`&.strip&.to_i
      Process.kill("HUP", pid)
      sleep 1
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

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