Sha256: 2e85bbf412a6cd5569bb37569d87207ef48291053341a44683ac31016f989fa5

Contents?: true

Size: 676 Bytes

Versions: 3

Compression:

Stored size: 676 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)
        def_par.offences.map(&:message).should ==
          ['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)
        def_par.offences.map(&:message).should == []
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.3.2 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.3.1 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.3.0 spec/rubocop/cops/def_without_parentheses_spec.rb