absolutize 0.0.11 → 0.0.12
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/README.textile +1 -1
- data/lib/absolutize.rb +1 -1
- metadata +5 -6
- data/spec/absolutize/absolutize_spec.rb~ +0 -64
data/README.textile
CHANGED
data/lib/absolutize.rb
CHANGED
@@ -11,7 +11,7 @@ class Absolutize
|
|
11
11
|
@options[:remove_anchors] = false if @options[:remove_anchors].nil?
|
12
12
|
@options[:force_escaping] = true if @options[:force_escaping].nil?
|
13
13
|
@options[:output_debug] = false if @options[:output_debug].nil?
|
14
|
-
@options[:raise_exceptions] = false if @options[:
|
14
|
+
@options[:raise_exceptions] = false if @options[:raise_exceptions].nil?
|
15
15
|
|
16
16
|
end
|
17
17
|
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: absolutize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 12
|
10
|
+
version: 0.0.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
- Stewart McKee
|
13
|
+
- Stewart McKee, Ijonas Kisselbach, Ross Macdonald
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-04 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -32,7 +32,6 @@ files:
|
|
32
32
|
- spec/spec_helper.rb~
|
33
33
|
- spec/spec_helper.rb
|
34
34
|
- spec/absolutize/absolutize_spec.rb
|
35
|
-
- spec/absolutize/absolutize_spec.rb~
|
36
35
|
- lib/absolutize.rb
|
37
36
|
- README.textile
|
38
37
|
has_rdoc: false
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe Absolutize do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@base_url = "http://www.baseurl.com/"
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "with default parameters" do
|
10
|
-
before(:each) do
|
11
|
-
@absolutize = Absolutize.new(@base_url)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should create an Absolutize object" do
|
15
|
-
@absolutize.should be_an_instance_of Absolutize
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should return the same url for an absolute url" do
|
19
|
-
@absolutize.url("http://www.bbc.co.uk/").to_s.should == "http://www.bbc.co.uk/"
|
20
|
-
end
|
21
|
-
it "should return the same url for an absolute url" do
|
22
|
-
@absolutize.url("http://www.bbc.co.uk//asdf/asdf.html").to_s.should == "http://www.bbc.co.uk/asdf/asdf.html"
|
23
|
-
end
|
24
|
-
it "should return the absolute url for a relative to root url" do
|
25
|
-
@absolutize.url("/asdf.html").to_s.should == "http://www.baseurl.com/asdf.html"
|
26
|
-
end
|
27
|
-
it "should return the absolute url for a relative to folder url" do
|
28
|
-
@absolutize.url("asdf.html").to_s.should == "http://www.baseurl.com/asdf.html"
|
29
|
-
end
|
30
|
-
it "should handle urls with spaces" do
|
31
|
-
@absolutize.url("/root folder/asdf.html").to_s.should == "http://www.baseurl.com/root%20folder/asdf.html"
|
32
|
-
end
|
33
|
-
it "should handle urls with ['s" do
|
34
|
-
@absolutize.url("/folder/asdf.html?id=[asdf]").to_s.should == "http://www.baseurl.com/folder/asdf.html?id=%5Basdf%5D"
|
35
|
-
end
|
36
|
-
it "should not encode urls with %'s" do
|
37
|
-
@absolutize.url("/root%20folder/asdf.html?id=asdf").to_s.should == "http://www.baseurl.com/root%20folder/asdf.html?id=asdf"
|
38
|
-
end
|
39
|
-
it "should not encode existing encoded characters" do
|
40
|
-
@absolutize.url("/root%20folder/asdf.html?id=[asdf]").to_s.should == "http://www.baseurl.com/root%20folder/asdf.html?id=%5Basdf%5D"
|
41
|
-
end
|
42
|
-
it "should encode with pipes" do
|
43
|
-
@absolutize.url("/root%20folder/asdf.html?lang=en|us").to_s.should == "http://www.baseurl.com/root%20folder/asdf.html?lang=en%7Cus"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "with remove_anchors true" do
|
48
|
-
before(:each) do
|
49
|
-
@absolutize = Absolutize.new(@base_url, :remove_anchors => true)
|
50
|
-
end
|
51
|
-
it "should remove an anchor" do
|
52
|
-
@absolutize.url("/root folder/asdf.html#anchor").to_s.should == "http://www.baseurl.com/root%20folder/asdf.html"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "with force_escaping false" do
|
57
|
-
before(:each) do
|
58
|
-
@absolutize = Absolutize.new(@base_url, :force_escaping => false)
|
59
|
-
end
|
60
|
-
it "should not escape invalid characters" do
|
61
|
-
lambda { @absolutize.url("/root folder/asdf.html#anchor")}.should raise_error
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|