jarrett-quarto 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/quarto/url_helper.rb +1 -7
- data/quarto.gemspec +1 -1
- data/spec/url_helper_spec.rb +7 -5
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.1
|
data/lib/quarto/url_helper.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'cgi'
|
2
|
-
require 'uri'
|
3
2
|
|
4
3
|
module Quarto
|
5
4
|
|
@@ -70,12 +69,7 @@ module Quarto
|
|
70
69
|
# Somewhat compatible with the Rails url_for helper.
|
71
70
|
def url_for(options = {})
|
72
71
|
if options.is_a?(String)
|
73
|
-
|
74
|
-
if uri.absolute?
|
75
|
-
uri.to_s
|
76
|
-
else
|
77
|
-
abs_url(uri.to_s)
|
78
|
-
end
|
72
|
+
options
|
79
73
|
else
|
80
74
|
url_for_with_element_wrapper(options)
|
81
75
|
end
|
data/quarto.gemspec
CHANGED
data/spec/url_helper_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'uri'
|
2
3
|
|
3
4
|
describe Quarto::UrlHelper do
|
4
5
|
include Quarto::UrlHelper
|
@@ -144,16 +145,17 @@ describe Quarto::UrlHelper do
|
|
144
145
|
end
|
145
146
|
end
|
146
147
|
|
147
|
-
it 'should call abs_url
|
148
|
-
['foo', '/foo'].each do |rel_url|
|
148
|
+
it 'should not call abs_url' do
|
149
|
+
['foo', '../foo', '/foo'].each do |rel_url|
|
149
150
|
template = TemplateOutsideRails.new
|
150
|
-
template.
|
151
|
+
template.should_not_receive(:abs_url)
|
151
152
|
template.url_for(rel_url)
|
152
153
|
end
|
153
154
|
end
|
154
155
|
|
155
|
-
it 'should not modify
|
156
|
-
['http://example.com', 'http://example.com/foo', 'https://example.com', 'ftp://example.com'
|
156
|
+
it 'should not modify a url, be it absolute or relative' do
|
157
|
+
['http://example.com', 'http://example.com/foo', 'https://example.com', 'ftp://example.com',
|
158
|
+
'foo', '../foo', '/foo'].each do |url|
|
157
159
|
TemplateOutsideRails.new.url_for(url).should == url
|
158
160
|
end
|
159
161
|
end
|