Sha256: 13807ec805cb902f9419b1e2b502f4eb8ecc2ba114239ce340f3ce912452cf99

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require File.expand_path('../test_helper', File.dirname(__FILE__))
require 'aws-sdk'
require File.expand_path('../../lib/coverband/reporters/web', File.dirname(__FILE__))
require 'rack/test'

ENV['RACK_ENV'] = 'test'

module Coverband
  class S3WebTest < Test::Unit::TestCase
    include Rack::Test::Methods

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

    # TODO add tests for all endpoints
    test 'renders index content' do
      get '/'
      assert last_response.ok?
      assert_match 'Coverband Web Admin Index', last_response.body
    end

    test 'renders show content' do
      Coverband.configuration.s3_bucket = 'coverage-bucket'
      s3 = mock('s3')
      Aws::S3::Client.expects(:new).returns(s3)
      s3.expects(:get_object).with(bucket: 'coverage-bucket', key: 'coverband/index.html').returns mock('response', body: mock('body', read: 'content'))
      get '/show'
      assert last_response.ok?
      assert_equal 'content', last_response.body
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coverband-2.0.2.alpha test/unit/reports_web_test.rb