link_oracle 0.0.8 → 0.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5df660e6b6c4f92eb3a53d4429a291c61b7c5940
4
- data.tar.gz: f88eda3c3d53ba133bbc0df3e3cd511957feab95
3
+ metadata.gz: d04bcd248e73e3676f3336a6f449e08befb632aa
4
+ data.tar.gz: f94766cf28495826f93005976edd5c6f27b4b113
5
5
  SHA512:
6
- metadata.gz: 0ccd2ad09b42768073c0a2f792fe2075b52a7e447120c0bc7834f5bea2ab5a89a8e98cf84b9ad512314821d744972cb50876e44e8c6e75dd94d79897c2f50656
7
- data.tar.gz: 2b4c1ba7dcd0cc232265f0f9da429c8c66bf7b46c29f2f2fcaedc1df380dfff589c7c5cbd6ffb25efc9ba4ec06046ef5d9204cf78e73dddad43636bc425ed0c9
6
+ metadata.gz: 0bcfabb56e346fd6f2295492e4e6544f9a481318c589ef602f7ca36edb8f752ad3786b44f8a5dea3285cd7988a7e87eb2a3310992e160c492f6f8cdc6911fee0
7
+ data.tar.gz: e064cfd38d170b0a5bc2f156e07db5f08bb4d8495670b892d81bf2670cf296c703105330faa4ee2aa8cecc1a31d2c4d5ded3e421f70ffafff2c9f1521be19c0c
@@ -22,8 +22,8 @@ class LinkOracle
22
22
 
23
23
  def get_content(selector)
24
24
  found = parsed_body.xpath(selector).first
25
- found ? [found[:content]] : []
25
+ (found && !found[:content].empty?) ? [found[:content]] : []
26
26
  end
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -18,4 +18,4 @@ class LinkOracle
18
18
  end
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -1,3 +1,3 @@
1
1
  class LinkOracle
2
- VERSION = "0.0.8"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -32,6 +32,30 @@ describe LinkOracle::Extractor::Meta do
32
32
  end
33
33
  end
34
34
 
35
+ context "the meta data is there but blank" do
36
+ let(:body) {
37
+ "<html>
38
+ <head>
39
+ <meta name=\"Description\" content=\"\">
40
+ <title></title>
41
+ <meta itemprop='thumbnailUrl' name='thumbnail' content=''>
42
+ </head>
43
+ </html>"
44
+ }
45
+
46
+ it 'should set link_data title to nil' do
47
+ link_data.title.should == nil
48
+ end
49
+
50
+ it 'should set link_data image_url to nil' do
51
+ link_data.image_url.should == nil
52
+ end
53
+
54
+ it 'should set link_data description to nil' do
55
+ link_data.description.should == nil
56
+ end
57
+ end
58
+
35
59
  context 'there is meta data' do
36
60
  it 'should populate link_data title' do
37
61
  link_data.title.should == 'TITLE!'
@@ -46,4 +70,4 @@ describe LinkOracle::Extractor::Meta do
46
70
  end
47
71
  end
48
72
  end
49
- end
73
+ end
@@ -34,6 +34,33 @@ describe LinkOracle::Extractor::OG do
34
34
  end
35
35
  end
36
36
 
37
+ context "the og data is blank" do
38
+ let(:body) {
39
+ "<html>
40
+ <head>
41
+ <meta property=\"og:title\" content=\"\">
42
+ <meta property=\"og:description\" content=\"\">
43
+ <meta property=\"og:image\" content=\"\">
44
+ <meta name=\"Description\" content=\" \tHere is a description not for facebook\t\">
45
+ <meta name=\"KEYWORDS\" content=\" \tKeywords, Keywords everywhere \t\">
46
+ <title>TITLE!</title>
47
+ </head>
48
+ </html>"
49
+ }
50
+
51
+ it 'should set title to nil' do
52
+ link_data.title.should == nil
53
+ end
54
+
55
+ it 'should set description to nil' do
56
+ link_data.description.should == nil
57
+ end
58
+
59
+ it 'should set image to nil' do
60
+ link_data.image_url.should == nil
61
+ end
62
+ end
63
+
37
64
  context 'there is og_data' do
38
65
 
39
66
  it 'should populate link_data title' do
@@ -49,4 +76,4 @@ describe LinkOracle::Extractor::OG do
49
76
  end
50
77
  end
51
78
  end
52
- end
79
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: link_oracle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Cooper
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-05-06 00:00:00.000000000 Z
14
+ date: 2014-05-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: nokogiri