Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wpscanteam
GitHub Repository: wpscanteam/wpscan
Path: blob/master/spec/app/controllers/aliases_spec.rb
486 views
1
# frozen_string_literal: true
2
3
describe WPScan::Controller::Aliases do
4
subject(:controller) { described_class.new }
5
let(:target_url) { 'http://ex.lo/' }
6
let(:cli_args) { "--url #{target_url}" }
7
8
before do
9
WPScan::ParsedCli.options = rspec_parsed_options(cli_args)
10
end
11
12
describe '#cli_options' do
13
its(:cli_options) { should_not be_empty }
14
its(:cli_options) { should be_a Array }
15
16
it 'contains to correct options' do
17
expect(controller.cli_options.map(&:to_sym)).to eq %i[stealthy]
18
end
19
end
20
21
describe 'parsed_options' do
22
context 'when no --stealthy supplied' do
23
it 'contains the correct options' do
24
expect(WPScan::ParsedCli.options).to include(
25
detection_mode: :mixed, plugins_version_detection: :mixed
26
)
27
end
28
end
29
30
context 'when --stealthy supplied' do
31
let(:cli_args) { "#{super()} --stealthy" }
32
33
it 'contains the correct options' do
34
expect(WPScan::ParsedCli.options).to include(
35
random_user_agent: true, detection_mode: :passive, plugins_version_detection: :passive
36
)
37
end
38
end
39
end
40
end
41
42