Sha256: df9ac593c569db339871b7b51bb745c5e0dd51bb56d0b5b7305d1471541201e5

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'support/shared_examples_for_issue_checks'

RSpec.describe Pluginscan::FileIssuesScanner do
  before(:all) { @scanner = Pluginscan::FileIssuesScanner.new(Pluginscan::THE_CHECKS) }
  let(:runner_run_results) { @scanner.scan(file_contents) }

  describe 'run' do
    context 'with an empty file' do
      let(:file_contents) { "" }
      it "finds no results" do
        expect(runner_run_results).to eq []
      end
    end

    describe "matches at the beginning of the line" do
      # Artificial examples, but older versions of the `function list` helper
      # would have failed to match these
      it_behaves_like "matches lines containing", "$_POST",         %($_POST[$tagname] : '';)
      it_behaves_like "matches lines containing", "$wpdb",          %($wpdb->prepare( " AND meta_value = %d", $old_id );)
      it_behaves_like "matches lines containing", "wp_remote_post", %(wp_remote_post( $url, $req_args );)
      it_behaves_like "matches lines containing", "glob",           %(glob( $directory_pattern );)
      it_behaves_like "matches lines containing", "wp_unslash",     %(wp_unslash( $answer );)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pluginscan-0.9.0 spec/pluginscan/issues_scanner/file_issues_scanner_spec.rb