Method: RuboCop::RSpec::ExpectOffense#expect_no_corrections
- Defined in:
- lib/rubocop/rspec/expect_offense.rb
#expect_no_corrections ⇒ Object
rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/rubocop/rspec/expect_offense.rb', line 182 def expect_no_corrections raise '`expect_no_corrections` must follow `expect_offense`' unless @processed_source return if @last_corrector.empty? # This is just here for a pretty diff if the source actually got changed new_source = @last_corrector.rewrite expect(new_source).to eq(@processed_source.buffer.source) # There is an infinite loop if a corrector is present that did not make # any changes. It will cause the same offense/correction on the next loop. raise RuboCop::Runner::InfiniteCorrectionLoop.new(@processed_source.path, [@offenses]) end |