Sha256: 320cd53c47703729001f3606a89253ceb7ea2b90d6a33407854b70e4f28de126
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop describe SpaceAroundEqualsInParameterDefault do let(:space) { SpaceAroundEqualsInParameterDefault.new } it 'registers an offence for default value assignment without space' do inspect_source(space, ['def f(x, y=0, z=1)', 'end']) expect(space.offences.map(&:message)).to eq( ['Surrounding space missing in default value assignment.'] * 2) end it 'registers an offence for assignment of empty string without space' do inspect_source(space, ['def f(x, y="", z=1)', 'end']) expect(space.offences.size).to eq(2) end it 'registers an offence for assignment of empty list without space' do inspect_source(space, ['def f(x, y=[])', 'end']) expect(space.offences.size).to eq(1) end it 'accepts default value assignment with space' do inspect_source(space, ['def f(x, y = 0, z = {})', 'end']) expect(space.offences.map(&:message)).to be_empty end end end end
Version data entries
4 entries across 4 versions & 1 rubygems