StatsPlugin spec fixes
This commit is contained in:
@@ -20,49 +20,45 @@
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../wpstools_helper')
|
||||
|
||||
describe 'StatsPlugin' do
|
||||
before :each do
|
||||
@stats = StatsPlugin.new()
|
||||
end
|
||||
subject(:stats) { StatsPlugin.new }
|
||||
let(:plugins_vulns) { MODELS_FIXTURES + '/wp_plugin/vulnerable/plugins_vulns.xml' }
|
||||
let(:themes_vulns) { MODELS_FIXTURES + '/wp_theme/vulnerable/themes_vulns.xml' }
|
||||
let(:plugins_file) { COLLECTIONS_FIXTURES + '/wp_plugins/detectable/targets.txt' }
|
||||
let(:themes_file) { COLLECTIONS_FIXTURES + '/wp_themes/detectable/targets.txt'}
|
||||
|
||||
describe '#vuln_plugin_count' do
|
||||
it 'should return the correct number' do
|
||||
xml = "#{SPEC_FIXTURES_WPSCAN_WP_PLUGIN_DIR}/vulnerabilities/plugin_vulns.xml"
|
||||
@stats.vuln_plugin_count(xml).should == 2
|
||||
it 'returns the correct number' do
|
||||
stats.vuln_plugin_count(plugins_vulns).should == 2
|
||||
end
|
||||
end
|
||||
|
||||
describe '#vuln_theme_count' do
|
||||
it 'should return the correct number' do
|
||||
xml = "#{SPEC_FIXTURES_WPSCAN_WP_THEME_DIR}/vulnerabilities/theme_vulns.xml"
|
||||
@stats.vuln_theme_count(xml).should == 2
|
||||
it 'returns the correct number' do
|
||||
stats.vuln_theme_count(themes_vulns).should == 2
|
||||
end
|
||||
end
|
||||
|
||||
describe '#plugin_vulns_count' do
|
||||
it 'should return the correct number' do
|
||||
xml = "#{SPEC_FIXTURES_WPSCAN_WP_PLUGIN_DIR}/vulnerabilities/plugin_vulns.xml"
|
||||
@stats.plugin_vulns_count(xml).should == 3
|
||||
it 'returns the correct number' do
|
||||
stats.plugin_vulns_count(plugins_vulns).should == 3
|
||||
end
|
||||
end
|
||||
|
||||
describe '#theme_vulns_count' do
|
||||
it 'should return the correct number' do
|
||||
xml = "#{SPEC_FIXTURES_WPSCAN_WP_THEME_DIR}/vulnerabilities/theme_vulns.xml"
|
||||
@stats.theme_vulns_count(xml).should == 3
|
||||
it 'returns the correct number' do
|
||||
stats.theme_vulns_count(themes_vulns).should == 3
|
||||
end
|
||||
end
|
||||
|
||||
describe '#total_plugins' do
|
||||
it 'should return the correct numer' do
|
||||
file = "#{SPEC_FIXTURES_WPSCAN_WP_PLUGIN_DIR}/plugins.txt"
|
||||
@stats.total_plugins(file).should == 4
|
||||
it 'returns the correct numer' do
|
||||
stats.total_plugins(plugins_file).should == 3
|
||||
end
|
||||
end
|
||||
|
||||
describe '#total_themes' do
|
||||
it 'should return the correct numer' do
|
||||
file = "#{SPEC_FIXTURES_WPSCAN_WP_THEME_DIR}/themes.txt"
|
||||
@stats.total_themes(file).should == 5
|
||||
it 'returns the correct numer' do
|
||||
stats.total_themes(themes_file).should == 3
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user