Rspec fixes

This commit is contained in:
Erwan
2012-10-23 12:19:16 +02:00
parent 38d335193f
commit fd5cf4785c
2 changed files with 12 additions and 12 deletions

View File

@@ -56,9 +56,9 @@ class WpEnumerator
request_count += 1 request_count += 1
request.on_complete do |response| request.on_complete do |response|
if options[:show_progress_bar]
print "\rChecking for #{enumerate_size} total #{options[:type]}... #{(request_count * 100) / enumerate_size}% complete." print "\rChecking for #{enumerate_size} total #{options[:type]}... #{(request_count * 100) / enumerate_size}% complete." if options[:show_progress_bar]
end
if WpTarget.valid_response_codes.include?(response.code) if WpTarget.valid_response_codes.include?(response.code)
if Digest::MD5.hexdigest(response.body) != options[:error_404_hash] if Digest::MD5.hexdigest(response.body) != options[:error_404_hash]
found << target found << target

View File

@@ -103,7 +103,7 @@ describe WpTarget do
end end
it "should return the string set in the initialize method" do it "should return the string set in the initialize method" do
@wp_target = WpTarget.new("http://example.localhost/", :wp_content_dir => "hello-world") @wp_target = WpTarget.new("http://example.localhost/", @options.merge(:wp_content_dir => "hello-world"))
@expected = "hello-world" @expected = "hello-world"
end end
@@ -159,7 +159,7 @@ describe WpTarget do
end end
it "should return the string set in the initialize method" do it "should return the string set in the initialize method" do
@wp_target = WpTarget.new("http://example.localhost/", :wp_content_dir => "asdf", :wp_plugins_dir => "custom-plugins") @wp_target = WpTarget.new("http://example.localhost/", @options.merge(:wp_content_dir => "asdf", :wp_plugins_dir => "custom-plugins"))
@expected = "custom-plugins" @expected = "custom-plugins"
end end
@@ -169,22 +169,22 @@ describe WpTarget do
end end
it "should return 'wp-content/plugins'" do it "should return 'wp-content/plugins'" do
@stub_value = nil @wp_target = WpTarget.new("http://example.localhost/", @options.merge(:wp_content_dir => "wp-content", :wp_plugins_dir => nil))
@expected = "wp-content/plugins" @expected = "wp-content/plugins"
end end
end end
describe "#wp_plugins_dir_exists?" do describe "#wp_plugins_dir_exists?" do
it "should return true" do it "should return true" do
target = WpTarget.new("http://example.localhost/", :wp_content_dir => "asdf", :wp_plugins_dir => "custom-plugins") target = WpTarget.new("http://example.localhost/", @options.merge(:wp_content_dir => "asdf", :wp_plugins_dir => "custom-plugins"))
url = target.uri.merge(target.wp_plugins_dir).to_s url = target.uri.merge(target.wp_plugins_dir).to_s
stub_request(:any, url).to_return(:status => 200) stub_request(:any, url).to_return(:status => 200)
target.wp_plugins_dir_exists?.should == true target.wp_plugins_dir_exists?.should == true
end end
it "should return false" do it "should return false" do
target = WpTarget.new("http://example.localhost/", :wp_content_dir => "asdf", :wp_plugins_dir => "custom-plugins") target = WpTarget.new("http://example.localhost/", @options.merge(:wp_content_dir => "asdf", :wp_plugins_dir => "custom-plugins"))
url = target.uri.merge(target.wp_plugins_dir).to_s url = target.uri.merge(target.wp_plugins_dir).to_s
stub_request(:any, url).to_return(:status => 404) stub_request(:any, url).to_return(:status => 404)
target.wp_plugins_dir_exists?.should == false target.wp_plugins_dir_exists?.should == false
end end
@@ -217,7 +217,7 @@ describe WpTarget do
end end
it "should also detect it if there are PHP notice" do it "should also detect it if there are PHP notice" do
@fixture = fixtures_dir + "/debug-notice.log" @fixture = fixtures_dir + "/debug-notice.log"
@expected = true @expected = true
end end
end end