Files
wpscan/spec/lib/common/plugins/plugin_spec.rb
2013-01-17 13:08:01 +01:00

47 lines
1.2 KiB
Ruby

require 'spec_helper'
describe Plugin do
subject(:plugin) { Plugin.new }
describe "#new" do
context "with some infos" do
subject(:plugin) { Plugin.new(infos) }
let(:infos) { {:author => "John"} }
its(:author) { should === infos[:author] }
end
end
describe "#run" do
it "should raise a NotImplementedError" do
expect { plugin.run }.to raise_error(NotImplementedError)
end
end
describe "#register_options" do
after :each do
if @exception
expect { plugin.register_options(*@options) }.to raise_error(@exception)
else
plugin.register_options(*@options)
plugin.registered_options.sort.should === @expected.sort
end
end
context "when an option is not an Array" do
it "should raise an error" do
@options = [["-v", "--verbose", "It's a valid option"], "Not a valid one"]
@exception = "Each option must be an array, String supplied"
end
end
context "when options are Arrays" do
it "should register the options" do
@options = [["-v", "--verbose", "Verbose mode"], ["-u", "--url TARGET_URL"]]
@expected = *@options
end
end
end
end