Sha256: f646a0f44fa4b401eadc02a3128f11fba01d053b75cd2178eed61d9b6f510bca
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
RSpec.shared_examples "matches lines containing" do |match, example_string, check_index: 0, match_index: 0, ignored: false| context match do context example_string do before(:all) { @scanner = described_class.new(Pluginscan::THE_CHECKS) } let(:file_contents) { example_string } let(:checks_findings) { @scanner.scan(file_contents) } let(:check_findings) { checks_findings[check_index] } let(:finding) do raise "Tried to get findings for the #{check_index}th check matching this line, but only #{checks_findings.count} checks match this line" if check_findings.nil? check_findings.findings[match_index] end it "finds a finding which checks_findings #{match}" do expect(checks_findings).to_not be_empty expect(finding.lineno).to eq 1 expect(finding.line).to eq file_contents expect(finding.match).to eq match expect(finding.ignored).to eq ignored end end end end RSpec.shared_examples "ignores lines containing" do |match, example_string, check_index: 0, match_index: 0| it_behaves_like "matches lines containing", match, example_string, check_index: check_index, match_index: match_index, ignored: true end RSpec.shared_examples "matches a variable assigned to a superglobal" do |superglobal| example_string = "$value = #{superglobal}['foo']" it_behaves_like "matches lines containing", superglobal, example_string end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pluginscan-0.9.0 | spec/support/shared_examples_for_issue_checks.rb |