module RuboCop::RSpec::ExpectOffense
def expect_no_offenses(source, file = nil)
def expect_no_offenses(source, file = nil) inspect_source(source, file) expect(cop.offenses).to be_empty end
def expect_offense(source, file = nil)
def expect_offense(source, file = nil) expected_annotations = AnnotatedSource.parse(source) if expected_annotations.plain_source == source raise 'Use expect_no_offenses to assert that no offenses are found' end inspect_source(expected_annotations.plain_source, file) actual_annotations = expected_annotations.with_offense_annotations(cop.offenses) expect(actual_annotations.to_s).to eq(expected_annotations.to_s) end