bugfixing and more rspec tests

This commit is contained in:
Christian Mehlmauer
2012-09-21 22:10:33 +02:00
parent 7a224a078b
commit 29280dc0ab
50 changed files with 206 additions and 83 deletions

View File

@@ -129,5 +129,10 @@ describe WpOptions do
@options[:type] = nil
@message = "type must be set"
end
it "should raise an exception (type unknown)" do
@options[:type] = "unknown"
@message = "Unknown type unknown"
end
end
end

View File

@@ -88,7 +88,8 @@ describe "WpscanOptions" do
describe "#enumerate_plugins=" do
it "should raise an error" do
@wpscan_options.enumerate_only_vulnerable_plugins = true
expect { @wpscan_options.enumerate_plugins = true }.to raise_error
expect { @wpscan_options.enumerate_plugins = true }.to raise_error(RuntimeError,
"You can't enumerate plugins and only vulnerable plugins at the same time, please choose only one")
end
it "should not raise an error" do
@@ -99,10 +100,26 @@ describe "WpscanOptions" do
end
end
describe "#enumerate_themes=" do
it "should raise an error" do
@wpscan_options.enumerate_only_vulnerable_themes = true
expect { @wpscan_options.enumerate_themes = true }.to raise_error(RuntimeError,
"You can't enumerate themes and only vulnerable themes at the same time, please choose only one")
end
it "should not raise an error" do
@wpscan_options.enumerate_only_vulnerable_themes = false
@wpscan_options.enumerate_themes = true
@wpscan_options.enumerate_themes.should be_true
end
end
describe "#enumerate_only_vulnerable_plugins=" do
it "should raise an error" do
@wpscan_options.enumerate_plugins = true
expect { @wpscan_options.enumerate_only_vulnerable_plugins = true }.to raise_error
expect { @wpscan_options.enumerate_only_vulnerable_plugins = true }.to raise_error(RuntimeError,
"You can't enumerate plugins and only vulnerable plugins at the same time, please choose only one")
end
it "should not raise an error" do
@@ -113,6 +130,21 @@ describe "WpscanOptions" do
end
end
describe "#enumerate_only_vulnerable_themes=" do
it "should raise an error" do
@wpscan_options.enumerate_themes = true
expect { @wpscan_options.enumerate_only_vulnerable_themes = true }.to raise_error(RuntimeError,
"You can't enumerate themes and only vulnerable themes at the same time, please choose only one")
end
it "should not raise an error" do
@wpscan_options.enumerate_themes = false
@wpscan_options.enumerate_only_vulnerable_themes = true
@wpscan_options.enumerate_only_vulnerable_themes.should be_true
end
end
describe "#to_h" do
it "should return an empty hash" do
@wpscan_options.to_h.should be_a Hash