brew vendor-gems: commit updates.

This commit is contained in:
Mike McQuaid 2019-08-04 20:15:00 +01:00
parent 753e11151b
commit 49149aa012
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
98 changed files with 73 additions and 3 deletions

View File

@ -61,8 +61,8 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-retry-0.6.1/lib
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.6.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.6.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.73.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.74.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.4.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.4.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.34.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.35.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-cobertura-1.3.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-cobertura-1.3.1/lib"

View File

@ -197,6 +197,11 @@ RSpec/HooksBeforeExamples:
Description: Checks for before/around/after hooks that come after an example. Description: Checks for before/around/after hooks that come after an example.
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
RSpec/ImplicitBlockExpectation:
Description: Check that implicit block expectation syntax is not used.
Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
RSpec/ImplicitExpect: RSpec/ImplicitExpect:
Description: Check that a consistent implicit expectation style is used. Description: Check that a consistent implicit expectation style is used.
Enabled: true Enabled: true

View File

@ -0,0 +1,64 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Check that implicit block expectation syntax is not used.
#
# Prefer using explicit block expectations.
#
# @example
# # bad
# subject { -> { do_something } }
# it { is_expected.to change(something).to(new_value) }
#
# # good
# it 'changes something to a new value' do
# expect { do_something }.to change(something).to(new_value)
# end
class ImplicitBlockExpectation < Cop
MSG = 'Avoid implicit block expectations.'
def_node_matcher :lambda?, <<-PATTERN
{
(send (const nil? :Proc) :new)
(send nil? :proc)
(send nil? :lambda)
}
PATTERN
def_node_matcher :lambda_subject?, '(block #lambda? ...)'
def_node_matcher :implicit_expect, <<-PATTERN
$(send nil? {:is_expected :should :should_not} ...)
PATTERN
def on_send(node)
implicit_expect(node) do |implicit_expect|
subject = nearest_subject(implicit_expect)
add_offense(implicit_expect) if lambda_subject?(subject&.body)
end
end
private
def nearest_subject(node)
node
.each_ancestor(:block)
.lazy
.select { |block_node| multi_statement_example_group?(block_node) }
.map { |block_node| find_subject(block_node) }
.find(&:itself)
end
def multi_statement_example_group?(node)
example_group_with_body?(node) && node.body.begin_type?
end
def find_subject(block_node)
block_node.body.child_nodes.find { |send_node| subject?(send_node) }
end
end
end
end
end

View File

@ -41,6 +41,7 @@ require_relative 'rspec/file_path'
require_relative 'rspec/focus' require_relative 'rspec/focus'
require_relative 'rspec/hook_argument' require_relative 'rspec/hook_argument'
require_relative 'rspec/hooks_before_examples' require_relative 'rspec/hooks_before_examples'
require_relative 'rspec/implicit_block_expectation'
require_relative 'rspec/implicit_expect' require_relative 'rspec/implicit_expect'
require_relative 'rspec/implicit_subject' require_relative 'rspec/implicit_subject'
require_relative 'rspec/instance_spy' require_relative 'rspec/instance_spy'

View File

@ -4,7 +4,7 @@ module RuboCop
module RSpec module RSpec
# Version information for the RSpec RuboCop plugin. # Version information for the RSpec RuboCop plugin.
module Version module Version
STRING = '1.34.1' STRING = '1.35.0'
end end
end end
end end