metainspector 1.9.8 → 1.9.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -170,7 +170,7 @@ module MetaInspector
170
170
  if url =~ /^\w*\:/i
171
171
  url
172
172
  else
173
- URI.parse(@root_url).merge(url).to_s
173
+ URI.parse(@root_url).merge(URI.encode(url)).to_s.gsub("%23", "#")
174
174
  end
175
175
  end
176
176
 
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module MetaInspector
4
- VERSION = "1.9.8"
4
+ VERSION = "1.9.9"
5
5
  end
@@ -0,0 +1,26 @@
1
+ HTTP/1.1 200 OK
2
+ Date: Mon, 30 May 2011 09:58:20 GMT
3
+ Server: Microsoft-IIS/6.0
4
+ X-Powered-By: PleskWin
5
+ X-Powered-By: ASP.NET
6
+ Cache-Control: private
7
+ Content-Length: 25902
8
+ Content-Type: text/html
9
+ Expires: Sun, 29 May 2011 09:58:18 GMT
10
+ Set-Cookie: ASPSESSIONIDCSBSQADC=AHENHHKBGGDIFJLHHCCJBHMP; path=/
11
+ Cache-control: private
12
+
13
+
14
+
15
+ <html>
16
+ <head>
17
+ <title>International chars</title>
18
+ </head>
19
+ <body>
20
+ <a href="/españa.asp">España</a>
21
+ <a href="/romanée">Romanée</a>
22
+ <a href="/faqs#camión">FAQs camión</a>
23
+ <a href="/search?q=camión">Search camión</a>
24
+ <a href="/search?q=españa#top">Search España at top</a>
25
+ </body>
26
+ </html>
@@ -18,6 +18,7 @@ describe MetaInspector do
18
18
  FakeWeb.register_uri(:get, "http://w3clove.com/faqs", :response => fixture_file("w3clove_faqs.response"))
19
19
  FakeWeb.register_uri(:get, "https://twitter.com/w3clove", :response => fixture_file("twitter_w3clove.response"))
20
20
  FakeWeb.register_uri(:get, "https://example.com/empty", :response => fixture_file("empty_page.response"))
21
+ FakeWeb.register_uri(:get, "http://international.com", :response => fixture_file("international.response"))
21
22
 
22
23
  describe 'Initialization' do
23
24
  it 'should accept an URL with a scheme' do
@@ -173,6 +174,15 @@ describe MetaInspector do
173
174
  "http://alazan.com/faqs.asp" ]
174
175
  end
175
176
 
177
+ it "should get correct absolute links, encoding the URLs as needed but respecting # and ?" do
178
+ m = MetaInspector.new('http://international.com')
179
+ m.links.should == [ "http://international.com/espa%C3%B1a.asp",
180
+ "http://international.com/roman%C3%A9e",
181
+ "http://international.com/faqs#cami%C3%B3n",
182
+ "http://international.com/search?q=cami%C3%B3n",
183
+ "http://international.com/search?q=espa%C3%B1a#top"]
184
+ end
185
+
176
186
  it "should return empty array if no links found" do
177
187
  m = MetaInspector.new('http://example.com/empty')
178
188
  m.links.should == []
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metainspector
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 33
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 9
9
- - 8
10
- version: 1.9.8
9
+ - 9
10
+ version: 1.9.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jaime Iniesta
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-12 00:00:00 Z
18
+ date: 2012-08-13 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -157,6 +157,7 @@ files:
157
157
  - spec/fixtures/alazan_websolution.response
158
158
  - spec/fixtures/empty_page.response
159
159
  - spec/fixtures/guardian.co.uk.response
160
+ - spec/fixtures/international.response
160
161
  - spec/fixtures/iteh.at.response
161
162
  - spec/fixtures/nonhttp.response
162
163
  - spec/fixtures/pagerankalert.com.response