Class: RuboCop::Cop::Gusto::VcrRecordings
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Gusto::VcrRecordings
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/gusto/vcr_recordings.rb
Overview
Requires VCR to be set to not record in tests.
Constant Summary collapse
- MSG =
"VCR should be set to not record in tests. Please use vcr: {record: :none}."
Instance Method Summary collapse
Instance Method Details
#on_pair(node) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/rubocop/cop/gusto/vcr_recordings.rb', line 27 def on_pair(node) return unless vcr_setting?(node) return unless recording_enabled?(node.key.children.first, node.value.children.first) add_offense(node) do |corrector| replacement = node.source.sub(/: :\w*/, ": :none") corrector.replace(node, replacement) end end |
#vcr_recording?(node) ⇒ Object
23 24 25 |
# File 'lib/rubocop/cop/gusto/vcr_recordings.rb', line 23 def_node_matcher :vcr_recording?, <<~PATTERN (pair (sym :record) (sym $_)) PATTERN |