class RuboCop::Cop::InSpecStyle::FileBeMounted
file resource deprecates matchers `be_mounted.with` and `be_mounted.only_with` in favor of the mount resource
Constants
- MSG
Public Instance Methods
on_block(node)
click to toggle source
# File lib/rubocop/cop/inspecstyle/file_be_mounted.rb, line 37 def on_block(node) return unless inside_file_spec?(node) node.descendants.each do |descendant| deprecated_file_matcher?(descendant) do |violation| add_offense( descendant, location: offense_range(descendant), message: format( MSG, violation: violation ) ) end end end
Private Instance Methods
inside_file_spec?(root)
click to toggle source
# File lib/rubocop/cop/inspecstyle/file_be_mounted.rb, line 55 def inside_file_spec?(root) spec?(root) && file_resource?(root) end
offense_range(node)
click to toggle source
# File lib/rubocop/cop/inspecstyle/file_be_mounted.rb, line 59 def offense_range(node) node.loc.selector end