This commit is contained in:
Erwan
2012-09-04 13:56:22 +02:00
parent eb10741912
commit 773ed7a2d1
2 changed files with 11 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ class WpTarget
attr_reader :uri, :verbose attr_reader :uri, :verbose
def initialize(target_url, options = {}) def initialize(target_url, options = {})
@uri = URI.parse(add_http_protocol(target_url)) @uri = URI.parse(add_trailing_slash(add_http_protocol(target_url)))
@verbose = options[:verbose] @verbose = options[:verbose]
@wp_content_dir = options[:wp_content_dir] @wp_content_dir = options[:wp_content_dir]
@wp_plugins_dir = options[:wp_plugins_dir] @wp_plugins_dir = options[:wp_plugins_dir]

View File

@@ -4,12 +4,12 @@ describe WpTarget do
before :each do before :each do
Browser.reset Browser.reset
browser_options = @browser_options =
{ {
:config_file => SPEC_FIXTURES_CONF_DIR + '/browser/browser.conf.json', :config_file => SPEC_FIXTURES_CONF_DIR + '/browser/browser.conf.json',
:cache_timeout => 0 :cache_timeout => 0
} }
@wp_target = WpTarget.new("http://example.localhost/", browser_options) @wp_target = WpTarget.new("http://example.localhost/", @browser_options)
end end
it_should_behave_like "WebSite" it_should_behave_like "WebSite"
@@ -27,6 +27,14 @@ describe WpTarget do
expect { WpTarget.new(nil) }.to raise_error expect { WpTarget.new(nil) }.to raise_error
expect { Wptarget.new('') }.to raise_error expect { Wptarget.new('') }.to raise_error
end end
it "should add the http protocol if missing" do
WpTarget.new("example.localhost/", @browser_options).url.should === "http://example.localhost/"
end
it "should add the trailing slash to the url if missing" do
WpTarget.new("lamp/wordpress", @browser_options).url.should === "http://lamp/wordpress/"
end
end end
describe "#url" do describe "#url" do