Sha256: d6bc3e43ce56fbe64cd3f79c5c907d4ed4fa69aa1476086a9bfba1599cb27ca9

Contents?: true

Size: 1.08 KB

Versions: 4

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 Home", last_response.body
      end

      test "renders index content for empty path" do
        get ""
        assert last_response.ok?
        assert_match "Coverband Home", 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

4 entries across 4 versions & 1 rubygems

Version Path
coverband-5.0.2 test/coverband/reporters/web_test.rb
coverband-5.0.1 test/coverband/reporters/web_test.rb
coverband-5.0.1.rc.1 test/coverband/reporters/web_test.rb
coverband-5.0.0 test/coverband/reporters/web_test.rb