Sha256: 7665394845fc885ae302270694605e17b2c89af8939aa66aff38c8f506f921ca

Contents?: true

Size: 1.21 KB

Versions: 17

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

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

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

  def teardown
    super
    shutdown_server
  end

  test "check view 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 1 && curl http://localhost:9999/coverage/view_tracker`
    assert output.match(/Used Views: \(1\)/)
    assert output.match(/dummy_view\/show/)
  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

17 entries across 17 versions & 1 rubygems

Version Path
coverband-5.2.3.2 test/forked/rails_view_tracker_stack_test.rb
coverband-5.2.3.1 test/forked/rails_view_tracker_stack_test.rb
coverband-5.2.5.rc.1 test/forked/rails_view_tracker_stack_test.rb
coverband-5.2.4 test/forked/rails_view_tracker_stack_test.rb
coverband-5.2.3 test/forked/rails_view_tracker_stack_test.rb
coverband-5.2.2 test/forked/rails_view_tracker_stack_test.rb
coverband-5.2.1 test/forked/rails_view_tracker_stack_test.rb
coverband-5.2.1.rc.1 test/forked/rails_view_tracker_stack_test.rb
coverband-5.2.0 test/forked/rails_view_tracker_stack_test.rb
coverband-5.2.0.rc.2 test/forked/rails_view_tracker_stack_test.rb
coverband-5.2.0.rc.1 test/forked/rails_view_tracker_stack_test.rb
coverband-5.1.1 test/forked/rails_view_tracker_stack_test.rb
coverband-5.1.0 test/forked/rails_view_tracker_stack_test.rb
coverband-5.1.0.rcmailer.2 test/forked/rails_view_tracker_stack_test.rb
coverband-5.1.0.rcmailer.1 test/forked/rails_view_tracker_stack_test.rb
coverband-5.0.3 test/forked/rails_view_tracker_stack_test.rb
coverband-5.0.2 test/forked/rails_view_tracker_stack_test.rb