Fix #3 Checking for the debug.log in wp-content

This commit is contained in:
Erwan
2012-07-29 14:32:32 +02:00
parent 872b293944
commit 93972d4803
4 changed files with 53 additions and 11 deletions

View File

@@ -109,8 +109,8 @@ describe WpTarget do
it "should also check in src attributes" do
@target_url = "http://lamp/wordpress-3.4.1"
@fixture = fixtures_dir + "/wordpress-3.4.1-in-src.htm"
@expected = "wp-content"
@fixture = fixtures_dir + "/wordpress-3.4.1-in-src.htm"
@expected = "wp-content"
end
end
@@ -132,4 +132,31 @@ describe WpTarget do
@expected = "wp-content/plugins"
end
end
describe "#debug_log_url" do
it "should return 'http://example.localhost/wp-content/debug.log" do
@wp_target.stub(:wp_content_dir => "wp-content")
@wp_target.debug_log_url.should === "http://example.localhost/wp-content/debug.log"
end
end
describe "#has_debug_log?" do
let(:fixtures_dir) { SPEC_FIXTURES_WPSCAN_WP_TARGET_DIR + "/debug_log" }
after :each do
@wp_target.stub(:wp_content_dir => "wp-content")
stub_request_to_fixture(:url => @wp_target.debug_log_url(), :fixture => @fixture)
@wp_target.has_debug_log?.should === @expected
end
it "should return false" do
@fixture = SPEC_FIXTURES_DIR + "/empty-file"
@expected = false
end
it "should return true" do
@fixture = fixtures_dir + "/debug.log"
@expected = true
end
end
end