rspec tests
This commit is contained in:
@@ -438,19 +438,40 @@ describe WpPlugin do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#wp_org_url" do
|
describe "#wp_org_url" do
|
||||||
before :each do
|
it "sould return a themes url" do
|
||||||
@instance = WpItem.new(
|
instance = WpItem.new(
|
||||||
:base_url => "http://sub.example.com/path/to/wordpress/",
|
:base_url => "http://sub.example.com/path/to/wordpress/",
|
||||||
:path => "test/asdf.php",
|
:path => "test/asdf.php",
|
||||||
:vulns_file => "XXX.xml",
|
:vulns_file => "XXX.xml",
|
||||||
:name => "test",
|
:name => "test",
|
||||||
:vulns_xpath => "XX",
|
:vulns_xpath => "XX",
|
||||||
:type => "plugins"
|
:type => "themes"
|
||||||
)
|
)
|
||||||
|
instance.wp_org_url.to_s.should == "http://wordpress.org/extend/themes/test/"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should return the correct url" do
|
it "sould return a plugins url" do
|
||||||
@expected = "http://wordpress.org/extend/plugins/test/"
|
instance = WpItem.new(
|
||||||
|
:base_url => "http://sub.example.com/path/to/wordpress/",
|
||||||
|
:path => "test/asdf.php",
|
||||||
|
:vulns_file => "XXX.xml",
|
||||||
|
:name => "test",
|
||||||
|
:vulns_xpath => "XX",
|
||||||
|
:type => "plugins"
|
||||||
|
)
|
||||||
|
instance.wp_org_url.to_s.should == "http://wordpress.org/extend/plugins/test/"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "sould raise an exception" do
|
||||||
|
instance = WpItem.new(
|
||||||
|
:base_url => "http://sub.example.com/path/to/wordpress/",
|
||||||
|
:path => "test/asdf.php",
|
||||||
|
:vulns_file => "XXX.xml",
|
||||||
|
:name => "test",
|
||||||
|
:vulns_xpath => "XX",
|
||||||
|
:type => "invalid"
|
||||||
|
)
|
||||||
|
expect { instance.wp_org_url }.to raise_error(RuntimeError, "No Wordpress URL for invalid")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user