rspec tests

This commit is contained in:
Christian Mehlmauer
2013-01-14 15:05:55 +01:00
parent 36585891a1
commit 04fab49d44

View File

@@ -438,8 +438,20 @@ describe WpPlugin do
end
describe "#wp_org_url" do
before :each do
@instance = WpItem.new(
it "sould return a themes url" 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 => "themes"
)
instance.wp_org_url.to_s.should == "http://wordpress.org/extend/themes/test/"
end
it "sould return a plugins url" do
instance = WpItem.new(
:base_url => "http://sub.example.com/path/to/wordpress/",
:path => "test/asdf.php",
:vulns_file => "XXX.xml",
@@ -447,10 +459,19 @@ describe WpPlugin do
:vulns_xpath => "XX",
:type => "plugins"
)
instance.wp_org_url.to_s.should == "http://wordpress.org/extend/plugins/test/"
end
it "should return the correct url" do
@expected = "http://wordpress.org/extend/plugins/test/"
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