class RuboCop::Cop::Lint::NoVCRRecording
@example
# bad vcr: { record_mode: :once, tag: :foo } vcr: { record_mode: :none } # good vcr: { tag: :foo } vcr: true
Constants
- MSG
Public Instance Methods
Source
# File lib/rubocop/cop/lint/no_vcr_recording.rb, line 47 def on_pair(node) return unless is_only_setting_record_option?(node) || is_setting_record_option?(node) add_offense(node) do |corrector| if is_only_setting_record_option?(node) corrector.replace(node, "vcr: true") elsif is_setting_record_option?(node) corrector.replace(node, remove_record_option(node)) end end end
Private Instance Methods
Source
# File lib/rubocop/cop/lint/no_vcr_recording.rb, line 61 def remove_record_option(top_pair_node) extend AST::Sexp _vcr_key, hash = top_pair_node.children other_options = hash.children.reject do |pair| key, _value = pair.children key == s(:sym, :record) end Unparser.unparse(s(:pair, s(:sym, :vcr), s(:hash, *other_options))) end