Sha256: cfb9fdb46ef79e136a727dfe5182275878272001fe8cbf2b3ed5aa2333e3fb07

Contents?: true

Size: 1003 Bytes

Versions: 5

Compression:

Stored size: 1003 Bytes

Contents

require_relative '../../spec_helper'
require_relative '../../../lib/reek/examiner'
require_relative '../../../lib/reek/report/report'
require_relative '../../../lib/reek/report/formatter'

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

  context 'empty source' do
    let(:examiner) { Reek::Examiner.new('') }

    before do
      instance.add_examiner examiner
    end

    it 'prints empty checkstyle xml' do
      expect { instance.show }.to output("<?xml version='1.0'?>\n<checkstyle/>\n").to_stdout
    end
  end

  context 'source with voliations' do
    let(:examiner) { Reek::Examiner.new('def simple(a) a[0] end') }

    before do
      allow(File).to receive(:realpath).and_return('/some/path')
      instance.add_examiner examiner
    end

    it 'prints non-empty checkstyle xml' do
      sample_path = File.expand_path 'checkstyle.xml', 'spec/samples'
      expect { instance.show }.to output(File.read(sample_path)).to_stdout
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reek-3.0.4 spec/reek/report/xml_report_spec.rb
reek-3.0.3 spec/reek/report/xml_report_spec.rb
reek-3.0.2 spec/reek/report/xml_report_spec.rb
reek-3.0.1 spec/reek/report/xml_report_spec.rb
reek-3.0.0 spec/reek/report/xml_report_spec.rb