Fix #208 - Fixed vulnerable plugins still appear in the results
This commit is contained in:
@@ -39,6 +39,23 @@ shared_examples 'WpItem::Vulnerable' do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#vulnerable?' do
|
||||
after do
|
||||
subject.stub(:vulnerabilities).and_return(@stub)
|
||||
subject.vulnerable?.should == @expected
|
||||
end
|
||||
|
||||
it 'returns false when no vulnerabilities' do
|
||||
@stub = []
|
||||
@expected = false
|
||||
end
|
||||
|
||||
it 'returns true when vulnerabilities' do
|
||||
@stub = ['not empty']
|
||||
@expected = true
|
||||
end
|
||||
end
|
||||
|
||||
describe '#vulnerable_to?' do
|
||||
let(:version_orig) { '1.5.6' }
|
||||
let(:version_newer) { '1.6' }
|
||||
|
||||
@@ -178,12 +178,20 @@ shared_examples 'WpItems::Detectable' do
|
||||
let(:options) { { only_vulnerable: true } }
|
||||
let(:targets) { expected[:vulnerable_targets_items] }
|
||||
|
||||
it 'only checks vulnerable targets' do
|
||||
target = targets.sample
|
||||
@expected = subject.new << target
|
||||
it 'only checks and return vulnerable targets' do
|
||||
samples = targets.sample(2)
|
||||
fixed_target = samples[0]
|
||||
vulnerable_target = samples[1]
|
||||
|
||||
stub_targets_dont_exist(targets)
|
||||
target.stub(:exists?).and_return(true)
|
||||
|
||||
vulnerable_target.stub(:exists?).and_return(true)
|
||||
vulnerable_target.stub(:vulnerable?).and_return(true)
|
||||
|
||||
fixed_target.stub(:exists?).and_return(true)
|
||||
fixed_target.stub(:vulnerable?).and_return(false)
|
||||
|
||||
@expected = subject.new << vulnerable_target
|
||||
|
||||
subject.should_receive(:targets_items).and_return(targets)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user