Sha256: a0365332f5d300edb6efcd46fe1110ac15ad545a7cb9cc401cb1816040006c62

Contents?: true

Size: 698 Bytes

Versions: 4

Compression:

Stored size: 698 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe ParameterLists do
      let (:list) { ParameterLists.new }

      it 'registers an offence for a method def with 5 parameters' do
        inspect_source(list, 'file.rb', ['def meth(a, b, c, d, e)',
                                         'end'])
        list.offences.map(&:message).should ==
          ['Avoid parameter lists longer than four parameters.']
      end

      it 'accepts a method def with 4 parameters' do
        inspect_source(list, 'file.rb', ['def meth(a, b, c, d)',
                                         'end'])
        list.offences.map(&:message).should == []
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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