metainspector 2.3.1 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f703091a8a43619fd8f6ecfdb60de18a6325a41c
4
- data.tar.gz: 629dff9035a4c8c5c4aa6b27d73a3e689a0873a7
3
+ metadata.gz: 70997114bb41b0923e33d69ff5f0bfacee1c815d
4
+ data.tar.gz: 2d5e0c677d79ec0f27d3b964a986c6a90b3223f0
5
5
  SHA512:
6
- metadata.gz: 361be3755dbaab2ac880d8f5414c613ae1d3fde35899c6256710c8e94733105da4c13a007cfe002760775ef9b39961dc571c37470ecdba0ade89690aeac33de3
7
- data.tar.gz: 79eb048b137b55088b2e9ac587dfcd31300fa121073f79fcd8a5598e1384670f54fcc84cf4951f9d111f7e468219ec6fa065917146ebe622f42826ffadd7562f
6
+ metadata.gz: 6c5564c900e6a5716e87edd1c2f0d1b077ff197410691de0bb90a9315c5d40c8a34d912d40babdeb0c556b830b36f62f4319d2758b8a95618f62a6e795b17077
7
+ data.tar.gz: c5bbc6e6587f9ce53c87e9cba683be578d3ff416f10ae260da09946c9c7b683c3254040b72fcc6557bc31bac468efdb3a770f614fa1dfd327cc773d21590a80e
data/.travis.yml CHANGED
@@ -1,4 +1,3 @@
1
1
  rvm:
2
2
  - 1.9.3
3
- - 2.0.0
4
- - 2.1.1
3
+ - 2.1.2
data/README.md CHANGED
@@ -18,7 +18,7 @@ If you're using it on a Rails application, just add it to your Gemfile and run `
18
18
 
19
19
  gem 'metainspector'
20
20
 
21
- This gem is tested on Ruby versions 1.9.2, 1.9.3, 2.0.0 and 2.1.0.
21
+ This gem is tested on Ruby versions 1.9.3 and 2.1.2.
22
22
 
23
23
  ## Usage
24
24
 
@@ -41,12 +41,13 @@ module MetaInspector
41
41
  @exception_log << e
42
42
  end
43
43
 
44
- # Returns the parsed document title, from the content of the <title> tag.
44
+ # Returns the parsed document title, from the content of the <title> tag
45
+ # within the <head> section.
45
46
  # This is not the same as the meta_title tag
46
47
  def title
47
- @title ||= parsed.css('title').inner_text rescue nil
48
+ @title ||= parsed.css('head title').inner_text rescue nil
48
49
  end
49
-
50
+
50
51
  # Return favicon url if exist
51
52
  def favicon
52
53
  query = '//link[@rel="icon" or contains(@rel, "shortcut")]'
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module MetaInspector
4
- VERSION = "2.3.1"
4
+ VERSION = "2.3.2"
5
5
  end
@@ -0,0 +1,26 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx/0.7.67
3
+ Date: Fri, 18 Nov 2011 21:46:46 GMT
4
+ Content-Type: text/html
5
+ Connection: keep-alive
6
+ Last-Modified: Mon, 14 Nov 2011 16:53:18 GMT
7
+ Content-Length: 4987
8
+ X-Varnish: 2000423390
9
+ Age: 0
10
+ Via: 1.1 varnish
11
+
12
+ <html>
13
+ <head>
14
+ <title>An example page</title>
15
+ </head>
16
+ <body>
17
+ <!-- An SVG tag can have a title tag, should not interfere with the head title tag -->
18
+ <!-- https://github.com/jaimeiniesta/metainspector/issues/83 -->
19
+ <svg width="500" height="300" xmlns="http://www.w3.org/2000/svg">
20
+ <g>
21
+ <title>SVG Title Demo example</title>
22
+ <rect x="10" y="10" width="200" height="50" style="fill:none; stroke:blue; stroke-width:1px"/>
23
+ </g>
24
+ </svg>
25
+ </body>
26
+ </html>
data/spec/parser_spec.rb CHANGED
@@ -11,10 +11,6 @@ describe MetaInspector::Parser do
11
11
  @m = MetaInspector::Parser.new(doc 'http://pagerankalert.com')
12
12
  end
13
13
 
14
- it "should get the title" do
15
- @m.title.should == 'PageRankAlert.com :: Track your PageRank changes & receive alerts'
16
- end
17
-
18
14
  it "should not find an image" do
19
15
  @m.image.should == nil
20
16
  end
@@ -55,7 +51,7 @@ describe MetaInspector::Parser do
55
51
  it "should return the document as a string" do
56
52
  @m.to_s.class.should == String
57
53
  end
58
-
54
+
59
55
  describe "Feed" do
60
56
  it "should get rss feed" do
61
57
  @m = MetaInspector::Parser.new(doc 'http://www.iteh.at')
@@ -72,7 +68,12 @@ describe MetaInspector::Parser do
72
68
  @m.feed.should == nil
73
69
  end
74
70
  end
75
-
71
+
72
+ end
73
+
74
+ it "should get the title from the head section" do
75
+ p = MetaInspector::Parser.new(doc 'http://example.com')
76
+ p.title.should == 'An example page'
76
77
  end
77
78
 
78
79
  describe '#description' do
@@ -87,7 +88,7 @@ describe MetaInspector::Parser do
87
88
  @m.description.should == "SAN FRANCISCO—In a move expected to revolutionize the mobile device industry, Apple launched its fastest and most powerful iPhone to date Tuesday, an innovative new model that can only be seen by the company's hippest and most dedicated customers. This is secondary text picked up because of a missing meta description."
88
89
  end
89
90
  end
90
-
91
+
91
92
  describe '#favicon' do
92
93
  it "should get favicon link when marked as icon" do
93
94
  @m = MetaInspector::Parser.new(doc 'http://pagerankalert.com/')
data/spec/spec_helper.rb CHANGED
@@ -23,7 +23,12 @@ end
23
23
  # Faked web responses #
24
24
  #######################
25
25
 
26
- FakeWeb.register_uri(:get, "http://example.com/", :response => fixture_file("empty_page.response"))
26
+ # We're reorganizing fixtures, trying to combine them on as few as possible response files
27
+ # For each change in the fixtures, a comment should be included explaining why it's needed
28
+ # This is the base page to be used in the examples
29
+ FakeWeb.register_uri(:get, "http://example.com/", :response => fixture_file("example.response"))
30
+
31
+ # These are older fixtures
27
32
  FakeWeb.register_uri(:get, "http://pagerankalert.com", :response => fixture_file("pagerankalert.com.response"))
28
33
  FakeWeb.register_uri(:get, "http://pagerankalert-shortcut.com", :response => fixture_file("pagerankalert-shortcut.com.response"))
29
34
  FakeWeb.register_uri(:get, "http://pagerankalert-shortcut-and-icon.com", :response => fixture_file("pagerankalert-shortcut-and-icon.com.response"))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metainspector
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Iniesta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -157,6 +157,7 @@ files:
157
157
  - spec/fixtures/charset_001.response
158
158
  - spec/fixtures/charset_002.response
159
159
  - spec/fixtures/empty_page.response
160
+ - spec/fixtures/example.response
160
161
  - spec/fixtures/facebook.com.response
161
162
  - spec/fixtures/guardian.co.uk.response
162
163
  - spec/fixtures/https.facebook.com.response