Sha256: 2877078c70fbc5259dc0b95507cdb0d6d1b3017f433ef29ac5eb30e42ce85a6c

Contents?: true

Size: 713 Bytes

Versions: 3

Compression:

Stored size: 713 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe Offence do
      it 'has a few required attributes' do
        offence = Offence.new(:convention, 1, 'message')

        expect(offence.severity).to eq(:convention)
        expect(offence.line_number).to eq(1)
        expect(offence.message).to eq('message')
      end

      it 'overrides #to_s' do
        offence = Offence.new(:convention, 1, 'message')

        expect(offence.to_s).to eq('C:  1: message')
      end

      it 'does not blow up if a message contains %' do
        offence = Offence.new(:convention, 1, 'message % test')

        expect(offence.to_s).to eq('C:  1: message % test')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.6.1 spec/rubocop/cops/offence_spec.rb
rubocop-0.6.0 spec/rubocop/cops/offence_spec.rb
rubocop-0.5.0 spec/rubocop/cops/offence_spec.rb