Additional specs for #1374
This commit is contained in:
@@ -47,7 +47,7 @@ describe WPScan::DB::DynamicFinders::Plugin do
|
||||
describe '.create_versions_finders' do
|
||||
# handled and tested in spec/lib/finders/dynamic_finders/plugin_version_spec
|
||||
|
||||
describe 'Try to create the finders twice' do
|
||||
context 'When trying to create the finders twice' do
|
||||
# let's just test one slug, no need to test them all
|
||||
let(:slug) { '12-step-meeting-list' }
|
||||
|
||||
@@ -57,6 +57,14 @@ describe WPScan::DB::DynamicFinders::Plugin do
|
||||
expect { WPScan::DB::DynamicFinders::Plugin.create_versions_finders(slug) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the slug contains non alpha-numeric chars' do
|
||||
let(:slug) { 'test.something' }
|
||||
|
||||
it 'sanitize it and does not raise an error' do
|
||||
expect { WPScan::DB::DynamicFinders::Plugin.create_versions_finders(slug) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.version_finder_super_class' do
|
||||
|
||||
18
spec/lib/helper_spec.rb
Normal file
18
spec/lib/helper_spec.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe '#classify_slug' do
|
||||
{
|
||||
'slug' => :Slug,
|
||||
'slug-usual' => :SlugUsual,
|
||||
'12-slug' => :D_12Slug,
|
||||
'slug.s' => :SlugS,
|
||||
'slug yolo $' => :SlugYolo,
|
||||
'slug $ ab.cd/12' => :SlugAbCd12
|
||||
}.each do |slug, expected_symbol|
|
||||
context "when #{slug}" do
|
||||
it "returns #{expected_symbol}" do
|
||||
expect(classify_slug(slug)).to eql expected_symbol
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user