Fix specs #853
This commit is contained in:
@@ -70,9 +70,9 @@ shared_examples 'WpItems::Detectable' do
|
||||
end
|
||||
end
|
||||
|
||||
describe '::vulnerable_targets_items' do
|
||||
describe '::target_items' do
|
||||
after do
|
||||
results = subject.send(:vulnerable_targets_items, wp_target, item_class, vulns_file)
|
||||
results = subject.send(:target_items, wp_target, item_class, vulns_file, :all)
|
||||
|
||||
expect(results.map { |i| i.name }).to eq @expected.map { |i| i.name }
|
||||
|
||||
@@ -100,7 +100,7 @@ shared_examples 'WpItems::Detectable' do
|
||||
end
|
||||
|
||||
describe '::targets_items' do
|
||||
let(:options) { {} }
|
||||
let(:options) { { type: :all } }
|
||||
|
||||
after do
|
||||
if @expected
|
||||
@@ -111,28 +111,12 @@ shared_examples 'WpItems::Detectable' do
|
||||
end
|
||||
|
||||
context 'when :only_vulnerable' do
|
||||
let(:options) { { only_vulnerable: true } }
|
||||
let(:options) { { type: :vulnerable } }
|
||||
|
||||
it 'returns the expected Array of WpItem' do
|
||||
@expected = expected[:vulnerable_targets_items]
|
||||
end
|
||||
end
|
||||
|
||||
context 'when not :only_vulnerable' do
|
||||
context 'when no :file' do
|
||||
it 'raises an error' do
|
||||
expect { subject.send(:targets_items, wp_target, options) }.to raise_error('A file must be supplied')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when :file' do
|
||||
let(:options) { { file: targets_items_file } }
|
||||
|
||||
it 'returns the expected Array of WpItem' do
|
||||
@expected = (expected[:targets_items_from_file] + expected[:vulnerable_targets_items]).uniq {|t| t.name }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '::passive_detection' do
|
||||
|
||||
@@ -7,7 +7,7 @@ shared_examples 'WpPlugin::Vulnerable' do
|
||||
|
||||
context 'when :vulns_file is no set' do
|
||||
it 'returns the default one' do
|
||||
@expected = PLUGINS_VULNS_FILE
|
||||
@expected = PLUGINS_FILE
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ shared_examples 'WpTheme::Vulnerable' do
|
||||
|
||||
context 'when :vulns_file is not set' do
|
||||
it 'returns the default one' do
|
||||
@expected = THEMES_VULNS_FILE
|
||||
@expected = THEMES_FILE
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ shared_examples 'WpVersion::Vulnerable' do
|
||||
|
||||
context 'when :vulns_file is no set' do
|
||||
it 'returns the default one' do
|
||||
@expected = WP_VULNS_FILE
|
||||
@expected = WORDPRESSES_FILE
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user