Sha256: 520b6ae47bfdaa29361c5d982482b383631d1befab13cd256b0689f2c0cb0dcf

Contents?: true

Size: 822 Bytes

Versions: 4

Compression:

Stored size: 822 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.size).to eq(1)
      end

      it 'reports an offence for class def with parameters but no parens' do
        src = ['def Test.func a, b',
               'end']
        inspect_source(def_par, src)
        expect(def_par.offences.size).to eq(1)
      end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.8.3 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.8.2 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.8.1 spec/rubocop/cops/def_without_parentheses_spec.rb
rubocop-0.8.0 spec/rubocop/cops/def_without_parentheses_spec.rb