Sha256: 4d2959ad4e8bdb00228b8156e20d7e85426b40856b5e706d2b6eec3e87844359

Contents?: true

Size: 990 Bytes

Versions: 6

Compression:

Stored size: 990 Bytes

Contents

# encoding: utf-8

require 'spec_helper'
require 'stringio'

module Rubocop
  module Formatter
    describe EmacsStyleFormatter do
      let(:formatter) { EmacsStyleFormatter.new(output) }
      let(:output) { StringIO.new }

      describe '#report_file' do
        it 'displays parsable text' do
          cop = Cop::Cop.new
          source_buffer = Parser::Source::Buffer.new('test', 1)
          source_buffer.source = %w(a b cdefghi).join("\n")

          cop.add_offence(:convention,
                          Parser::Source::Range.new(source_buffer, 0, 1),
                          'message 1')
          cop.add_offence(:fatal,
                          Parser::Source::Range.new(source_buffer, 9, 10),
                          'message 2')

          formatter.report_file('test', cop.offences)
          expect(output.string).to eq ['test:1:1: C: message 1',
                                       "test:3:6: F: message 2\n"].join("\n")
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
rubocop-0.11.1 spec/rubocop/formatter/emacs_style_formatter_spec.rb
rubocop-0.11.0 spec/rubocop/formatter/emacs_style_formatter_spec.rb
rubocop-0.10.0 spec/rubocop/formatter/emacs_style_formatter_spec.rb
rubocop-0.9.1 spec/rubocop/formatter/emacs_style_formatter_spec.rb
sabat-rubocop-0.9.0 spec/rubocop/formatter/emacs_style_formatter_spec.rb
rubocop-0.9.0 spec/rubocop/formatter/emacs_style_formatter_spec.rb