Sha256: 8534b2b42de787226e7cca0d97829458d723555b696d62d8c995b533497d3f32

Contents?: true

Size: 583 Bytes

Versions: 1

Compression:

Stored size: 583 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe NewLambdaLiteral do
      let(:lambda_literal) { NewLambdaLiteral.new }

      it 'registers an offence for an old lambda call' do
        inspect_source(lambda_literal, ['f = lambda { |x| x }'])
        expect(lambda_literal.offences.size).to eq(1)
      end

      it 'accepts the new lambda literal' do
        inspect_source(lambda_literal, ['lambda = ->(x) { x }',
                                   'lambda.(1)'])
        expect(lambda_literal.offences).to be_empty
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-0.8.0 spec/rubocop/cops/new_lambda_literal_spec.rb