Sha256: fb25cc2dcf9b17b1faf8ae7585f1ffbb9ed4f8751716e5413926d3a6f9062d1b

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require File.expand_path('../../test_helper', File.dirname(__FILE__))
require 'aws-sdk-s3'
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
        Coverband.configuration.s3_bucket = nil
      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-4.2.7 test/coverband/reporters/web_test.rb
coverband-4.2.7.rc.1 test/coverband/reporters/web_test.rb
coverband-4.2.6 test/coverband/reporters/web_test.rb
coverband-4.2.5 test/coverband/reporters/web_test.rb
coverband-4.2.5.rc.2 test/coverband/reporters/web_test.rb
coverband-4.2.5.rc.1 test/coverband/reporters/web_test.rb