Sha256: 2fc8798e68b4ac00a1961313d2669ee6e368350fbf79f53898f68dc221ff95b0

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require File.expand_path('spec_helper', __dir__)

module Danger
  describe Danger::DangerUndercover do
    it 'is a Danger plugin' do
      expect(Danger::DangerUndercover.new(nil)).to be_a Danger::Plugin
    end

    describe 'Dangerfile' do
      before do
        @dangerfile = testing_dangerfile
        @undercover = @dangerfile.undercover
      end

      it 'fails if file is not found' do
        @undercover.report('spec/fixtures/missing_file.txt')

        expect(@dangerfile.status_report[:errors]).to eq(['Undercover: coverage report cannot be found.'])
      end

      it 'shows success message if nothing to report' do
        report_path = 'spec/fixtures/undercover_passed.txt'
        @undercover.report(report_path)
        report = File.open(report_path).read

        expect(@dangerfile.status_report[:messages]).to eq([report])
      end

      it 'shows warnings if undercover has a report' do
        report_path = 'spec/fixtures/undercover_failed.txt'
        @undercover.report(report_path)
        report = File.open(report_path).read

        expect(@dangerfile.status_report[:warnings]).to eq([report])
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
danger-undercover-1.1.0 spec/undercover_spec.rb
danger-undercover-1.0.0 spec/undercover_spec.rb