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.on_complete do |response|
if options[:show_progress_bar]
print "\rChecking for #{enumerate_size} total #{options[:type]}... #{(request_count * 100) / enumerate_size}% complete."
end
print "\rChecking for #{enumerate_size} total #{options[:type]}... #{(request_count * 100) / enumerate_size}% complete." if options[:show_progress_bar]
if WpTarget.valid_response_codes.include?(response.code)
if Digest::MD5.hexdigest(response.body) != options[:error_404_hash]
found << target

View File

@@ -103,7 +103,7 @@ describe WpTarget do
end
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"
end
@@ -159,7 +159,7 @@ describe WpTarget do
end
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"
end
@@ -169,21 +169,21 @@ describe WpTarget do
end
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"
end
end
describe "#wp_plugins_dir_exists?" 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
stub_request(:any, url).to_return(:status => 200)
target.wp_plugins_dir_exists?.should == true
end
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
stub_request(:any, url).to_return(:status => 404)
target.wp_plugins_dir_exists?.should == false