Sha256: 16269e4ef9f4eac1fbd13d8e1dfbb0ad7ba697ace39a73048df38bd735fb52a5

Contents?: true

Size: 688 Bytes

Versions: 13

Compression:

Stored size: 688 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe DefWithoutParentheses do
      let(:def_par) { DefWithoutParentheses.new }

      it 'reports an offence for def with parameters but no parens' do
        src = ['def func a, b',
               'end']
        inspect_source(def_par, '', src)
        expect(def_par.offences.map(&:message)).to eq(
          ['Use def with parentheses when there are arguments.'])
      end

      it 'accepts def with no args and no parens' do
        src = ['def func',
               'end']
        inspect_source(def_par, '', src)
        expect(def_par.offences.map(&:message)).to be_empty
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rubocop-0.7.2 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.7.1 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.7.0 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.6.1 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.6.0 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.5.0 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.4.6 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.4.5 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.4.4 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.4.3 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.4.2 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.4.1 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.4.0 spec/rubocop/cops/def_without_parentheses_spec.rb