Timthumb enumeration now working

This commit is contained in:
Christian Mehlmauer
2012-09-16 23:31:03 +02:00
parent cad84d38f4
commit 04414ebc69
7 changed files with 2513 additions and 2563 deletions

View File

@@ -216,36 +216,6 @@ describe Browser do
end
end
describe "#replace_variables_in_url" do
after :each do
@browser.variables_to_replace_in_url = @variables if @variables
@browser.send(:replace_variables_in_url, @url).should === @expected
end
it "should not replace anything (empty variables_to_replace_in_url)" do
@url = "http://target.tld/wp-content/file.txt"
@expected = @url
end
it "should not replace anything (not match found)" do
@variables = {"%nothing%" => "hello"}
@url = "http://target.tld/nothing/file.txt"
@expected = @url
end
it "should replace %wp-content% by 'custom-content'" do
@variables = {"%wp-content%" => "custom-content"}
@url = "http://target.tld/%wp-content%/some-file.txt"
@expected = "http://target.tld/custom-content/some-file.txt"
end
it "should replace %wp-content% by 'custom-content' and %plugins% by 'wp_plugins'" do
@variables = {"%wp-content%" => "custom-content", "%plugins%" => "wp_plugins"}
@url = "http://target.tld/%wp-content%/hello/%plugins%"
@expected = "http://target.tld/custom-content/hello/wp_plugins"
end
end
# TODO
describe "#forge_request" do

View File

@@ -31,7 +31,7 @@ describe WpTheme do
describe "#to_s" do
it "should return the theme name and the version if there is one" do
wp_theme = WpTheme.new(:name => "bueno", :version => "1.2.3")
wp_theme = WpTheme.new(:name => "bueno", :version => "1.2.3", :url => "", :path => "", :wp_content_dir => "")
wp_theme.to_s.should === "bueno v1.2.3"
end
@@ -41,7 +41,7 @@ describe WpTheme do
stub_request(:get, style_url).to_return(:status => 200, :body => "")
wp_theme = WpTheme.new(:name => "hello-world", :style_url => style_url)
wp_theme = WpTheme.new(:name => "hello-world", :style_url => style_url, :url => "", :path => "", :wp_content_dir => "")
wp_theme.to_s.should === "hello-world"
end
@@ -99,12 +99,12 @@ describe WpTheme do
it "should return a WpTheme object with .name 'Editorial' and .version '1.3.5'" do
@fixture = fixtures_dir + "/editorial-1.3.5.html"
@expected_theme = WpTheme.new("Editorial", :version => "1.3.5")
@expected_theme = WpTheme.new(:name => "Editorial", :version => "1.3.5", :url => "", :path => "", :wp_content_dir => "")
end
it "should return a WpTheme object with .name 'Merchant'" do
@fixture = fixtures_dir + "/merchant-no-version.html"
@expected_theme = WpTheme.new("Merchant")
@expected_theme = WpTheme.new(:name => "Merchant", :url => "", :path => "", :wp_content_dir => "")
end
end
@@ -148,7 +148,7 @@ describe WpTheme do
if @fixture
stub_request_to_fixture(:url => theme_style_url, :fixture => @fixture)
wp_theme = WpTheme.new('spec-theme', :style_url => theme_style_url)
wp_theme = WpTheme.new(:name => 'spec-theme', :style_url => theme_style_url, :url => "", :path => "", :wp_content_dir => "")
wp_theme.version.should === @expected
end
@@ -160,7 +160,7 @@ describe WpTheme do
end
it "should return nil if the style_url is nil" do
WpTheme.new("hello-world").version.should be_nil
WpTheme.new(:name => "hello-world", :url => "", :path => "", :wp_content_dir => "").version.should be_nil
end
it "should return 1.3" do