Sha256: 4ae19d114a398a4ab8b8fca8bc45d40f324355c8a4022bcbe364ca7607506202

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require File.expand_path("../../test_helper", File.dirname(__FILE__))
require File.expand_path("../../../lib/coverband/reporters/web", File.dirname(__FILE__))
require "rack/test"

ENV["RACK_ENV"] = "test"

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.2.0")
  module Coverband
    class WebTest < Minitest::Test
      include Rack::Test::Methods

      def app
        Coverband::Reporters::Web.new
      end

      def teardown
        super
      end

      test "renders index content" do
        get "/"
        assert last_response.ok?
        assert_match "Coverband Admin", last_response.body
      end

      test "renders index content for empty path" do
        get ""
        assert last_response.ok?
        assert_match "Coverband Admin", last_response.body
      end

      test "renders 404" do
        get "/show"
        assert last_response.not_found?
        assert_equal "404 error!", last_response.body
      end

      test "clears coverband" do
        post "/clear"
        assert_equal 301, last_response.status
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
coverband-5.0.0.rc.8 test/coverband/reporters/web_test.rb
coverband-5.0.0.rc.7 test/coverband/reporters/web_test.rb
coverband-5.0.0.rc.6 test/coverband/reporters/web_test.rb
coverband-5.0.0.rc.5 test/coverband/reporters/web_test.rb
coverband-5.0.0.rc.4 test/coverband/reporters/web_test.rb
coverband-5.0.0.rc.3 test/coverband/reporters/web_test.rb