Sha256: 1ffb9e0121618a803cfde98f31b0fc8c504365fcadf0bc314916a08f4793bbad

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

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, 'file.rb', ['def f(x, y=0, z=1)', 'end'])
        space.offences.map(&:message).should ==
          ['Surrounding space missing in default value assignment.'] * 2
      end

      it 'accepts default value assignment with space' do
        inspect_source(space, 'file.rb', ['def f(x, y = 0, z = 1)', 'end'])
        space.offences.map(&:message).should == []
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-0.3.2 spec/rubocop/cops/space_around_equals_in_default_parameter_spec.rb