textract 0.0.13 → 0.0.14

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.
@@ -16,7 +16,7 @@ describe Textract do
16
16
  article = Textract.get_text(url)
17
17
  expect(article.text.include?("Import")).to eq true
18
18
  expect(article.md5).to eq "9cc00fcdeb4bc41e0649d0776cbb2157"
19
- expect(article.author).to eq "Hamilton Nolan"
19
+ expect(article.author[:name]).to eq "Hamilton Nolan"
20
20
  end
21
21
  end
22
22
 
@@ -69,6 +69,20 @@ describe Textract do
69
69
  expect(Textract.get_author(html)).to eq "Adam Pash"
70
70
  end
71
71
 
72
+ it "gets twitter handle from metadata" do
73
+ html = '<html><head><meta name="twitter:creator" content="@adampash"></head><body><h1>FOO!</h1></body></html>'
74
+ expect(Textract.get_twitter(html)).to eq "@adampash"
75
+ end
76
+
77
+ it "gets more author detail when possible" do
78
+ VCR.use_cassette('twitter byline') do
79
+ url = "http://www.buzzfeed.com/daviddobbs/weighing-the-promises-of-big-genomics"
80
+ text = Textract.get_text(url)
81
+ expect(text.author[:name]).to eq "David Dobbs"
82
+ expect(text.author[:twitter]).to eq "@david_dobbs"
83
+ end
84
+ end
85
+
72
86
  it "converts itself to json" do
73
87
  VCR.use_cassette('json') do
74
88
  url = "http://gawker.com/1694508525"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textract
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Pash
@@ -175,6 +175,7 @@ files:
175
175
  - spec/fixtures/vcr_cassettes/robots.yml
176
176
  - spec/fixtures/vcr_cassettes/selector.yml
177
177
  - spec/fixtures/vcr_cassettes/stackoverflow.yml
178
+ - spec/fixtures/vcr_cassettes/twitter_byline.yml
178
179
  - spec/lib/textract_spec.rb
179
180
  - spec/spec_helper.rb
180
181
  - textract.gemspec
@@ -213,5 +214,6 @@ test_files:
213
214
  - spec/fixtures/vcr_cassettes/robots.yml
214
215
  - spec/fixtures/vcr_cassettes/selector.yml
215
216
  - spec/fixtures/vcr_cassettes/stackoverflow.yml
217
+ - spec/fixtures/vcr_cassettes/twitter_byline.yml
216
218
  - spec/lib/textract_spec.rb
217
219
  - spec/spec_helper.rb