Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wpscanteam
GitHub Repository: wpscanteam/wpscan
Path: blob/master/spec/app/finders/plugin_version_spec.rb
486 views
1
# frozen_string_literal: true
2
3
describe WPScan::Finders::PluginVersion::Base do
4
subject(:plugin_version) { described_class.new(plugin) }
5
let(:plugin) { WPScan::Model::Plugin.new(slug, target) }
6
let(:target) { WPScan::Target.new('http://wp.lab/') }
7
let(:default_finders) { %w[Readme] }
8
9
describe '#finders' do
10
after do
11
expect(target).to receive(:content_dir).and_return('wp-content')
12
expect(plugin_version.finders.map { |f| f.class.to_s.demodulize }).to match_array @expected
13
end
14
15
context 'when no related dynamic finders' do
16
let(:slug) { 'spec' }
17
18
it 'contains the default finders' do
19
@expected = default_finders
20
end
21
end
22
23
# Dynamic Version Finders are not tested here, they are in
24
# spec/lib/finders/dynamic_finder/plugin_versions_spec
25
context 'when dynamic finders' do
26
WPScan::DB::DynamicFinders::Plugin.versions_finders_configs.each do |plugin_slug, configs|
27
context "when #{plugin_slug} plugin" do
28
let(:slug) { plugin_slug }
29
30
it 'contains the expected finders (default + the dynamic ones)' do
31
@expected = default_finders + configs.keys
32
end
33
end
34
end
35
end
36
end
37
end
38
39