Sha256: b88b4f4795fb0083f90179c5640777e999b437c70521d034986caa83fdb31bfe

Contents?: true

Size: 793 Bytes

Versions: 3

Compression:

Stored size: 793 Bytes

Contents

require_relative '../../spec_helper'
require_lib 'reek/examiner'
require_lib 'reek/report/xml_report'

RSpec.describe Reek::Report::XMLReport do
  let(:xml_report) { described_class.new }

  context 'with an empty source' do
    it 'prints empty checkstyle XML' do
      xml_report.add_examiner Reek::Examiner.new('')
      xml = "<?xml version='1.0'?>\n<checkstyle/>\n"
      expect { xml_report.show }.to output(xml).to_stdout
    end
  end

  context 'with a source with violations' do
    it 'prints non-empty checkstyle XML' do
      xml_report.add_examiner Reek::Examiner.new(SMELLY_FILE)
      xml = SAMPLES_PATH.join('checkstyle.xml').read
      xml = xml.gsub(SMELLY_FILE.to_s, SMELLY_FILE.expand_path.to_s)
      expect { xml_report.show }.to output(xml).to_stdout
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reek-4.8.2 spec/reek/report/xml_report_spec.rb
reek-4.8.1 spec/reek/report/xml_report_spec.rb
reek-4.8.0 spec/reek/report/xml_report_spec.rb