Sha256: 1f8024d1f4d38aaf5e62c8cd8662b03086413f2a7e213c74864392b3d95123de
Contents?: true
Size: 911 Bytes
Versions: 13
Compression:
Stored size: 911 Bytes
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop describe DefWithParentheses do let(:def_par) { DefWithParentheses.new } it 'reports an offence for def with empty parens' do src = ['def func()', 'end'] inspect_source(def_par, '', src) expect(def_par.offences.map(&:message)).to eq( ["Omit the parentheses in defs when the method doesn't accept any " + 'arguments.']) end it 'accepts def with arg and parens' do src = ['def func(a)', 'end'] inspect_source(def_par, '', src) expect(def_par.offences.map(&:message)).to be_empty end it 'accepts empty parentheses in one liners' do src = ["def to_s() join '/' 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