Path: blob/master/spec/app/controllers/custom_directories_spec.rb
486 views
# frozen_string_literal: true12describe WPScan::Controller::CustomDirectories do3subject(:controller) { described_class.new }4let(:target_url) { 'http://ex.lo/' }5let(:cli_args) { "--url #{target_url}" }67before do8WPScan::ParsedCli.options = rspec_parsed_options(cli_args)9end1011describe '#cli_options' do12its(:cli_options) { should_not be_empty }13its(:cli_options) { should be_a Array }1415it 'contains to correct options' do16expect(controller.cli_options.map(&:to_sym)).to eq %i[wp_content_dir wp_plugins_dir]17end18end1920describe '#before_scan' do21context 'when the content_dir is not found and not supplied' do22before { expect(controller.target).to receive(:content_dir).and_return(nil) }2324it 'raises an exception' do25expect { controller.before_scan }.to raise_error(WPScan::Error::WpContentDirNotDetected)26end27end2829context 'when content_dir found/supplied' do30let(:cli_args) { "#{super()} --wp-content-dir wp-content" }3132it 'does not raise any error' do33expect { controller.before_scan }.to_not raise_error34expect(controller.target.content_dir).to eq WPScan::ParsedCli.wp_content_dir35end36end37end38end394041