web_stat 0.1.9 → 0.1.10

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
  SHA256:
3
- metadata.gz: eac27b56696b45e9a9ffb5cd0cf30b6b9592cdcae2f9b1c1ecf21a42218e888c
4
- data.tar.gz: 2871c2a2ac33aea9262ccacbbfce10a368a9b23f403b92634fa28b15021f3b15
3
+ metadata.gz: 64704708ad3a68f17bfc9fb3486a183ce11264f92f6f122f0381ddb85a8443cd
4
+ data.tar.gz: ebf7d763f6a055956940884f6abe20a57335324c11de366de45698197cd75f23
5
5
  SHA512:
6
- metadata.gz: c4bbae3ab1e51cc4ad9f21cac3deb158fd5967213bc30d6a7afbb841d9bda9e15b7de5952fbe962b0fd54473ce2c18969ed9aa7aab03ee8054b33935691553e5
7
- data.tar.gz: cfaab0c17980a6e1f6603e9223559caf67dc6367ef56fdb7335f558cb3863b034daec1261d0cb4726abb0e2b60a3c18c59a36a58f66f05627a69b3212d346703
6
+ metadata.gz: da1e0c1acf2b72e0df9584babb95faea89e5f5baa4c7d0f93ec782676cfca65d029e0ec0463997febed9dc9eecd9223d2f9a575b51709b5fc3e81f6f2e0d6544
7
+ data.tar.gz: ffe0efb47f339484a1b6ba4291ceae322e36ddd55fab2954ab7954c61e8d577cff0dc3367d3b5842c81fbdf6cf4561da6f3a3b49b3bb6e693048ef78487dc4dc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- web_stat (0.1.8)
4
+ web_stat (0.1.10)
5
5
  bundler (~> 2.0)
6
6
  final_redirect_url (~> 0.1.0)
7
7
  mechanize (~> 2.7)
@@ -50,6 +50,8 @@ module WebStat
50
50
  end
51
51
  if path.match(/^\//)
52
52
  "#{URI.parse(@url).scheme}://#{URI.parse(@url).host}#{path}"
53
+ else
54
+ path
53
55
  end
54
56
  end
55
57
 
@@ -1,3 +1,3 @@
1
1
  module WebStat
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
@@ -26,6 +26,7 @@ buildをやってもrequire_pathsに書いたディレクトリはビルド対
26
26
  <meta property="article:tag" content="rubygems" />
27
27
 
28
28
  <meta property="article:publisher" content="https://www.facebook.com/newsdict" />
29
+ <meta name="twitter:image" content="https://cdn.newsdict.jp/assets/newsdict-5d8601394c3f4eea2d7161ab92ab327ac7099e22214c853327011b3a71859b8e.png" />
29
30
  <meta name="twitter:card" content="summary" />
30
31
  <meta name="twitter:title" content="gem作成でついまずいたところ" />
31
32
  <meta name="twitter:description" content="・gitにcommit してないものは、gem build *.gemspec, rake
@@ -1,14 +1,14 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <meta charset="utf-8">
5
- <title>h1 - newsdict.blog</title>
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
4
+ <meta charset="utf-8">
5
+ <title>h1 - newsdict.blog</title>
6
+ <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
7
7
  </head>
8
8
  <body class="post-template tag-rubygems">
9
- <h1 class="post-title">gem作成でついまずいたところ</h1>
10
- <p class="profile"><a href="https://newsdict.blog">
11
- <img src="/content/images/size/w100/2019/03/facebook-3.jpg" alt="Yusuke Abe" class="avatar" /></a></p>
12
-
9
+ <h1 class="post-title">gem作成でついまずいたところ</h1>
10
+ <p class="profile"><a href="https://newsdict.blog">
11
+ <img alt="Yusuke Abe" class="avatar" src="/content/images/size/w100/2019/03/facebook-3.jpg"/></a>
12
+ </p>
13
13
  </body>
14
14
  </html>
@@ -80,3 +80,9 @@ WebMock.stub_request(:get, "https://newsdict.blog/content/images/size/w100/2019/
80
80
  status: 200,
81
81
  body: File.new(File.join(File.dirname(__FILE__), "fixtures", "images", "facebook-3.jpg")),
82
82
  headers: {content_type: 'application/html; charset=utf-8'})
83
+
84
+ WebMock.stub_request(:get, "https://cdn.newsdict.jp/assets/newsdict-5d8601394c3f4eea2d7161ab92ab327ac7099e22214c853327011b3a71859b8e.png")
85
+ .to_return(
86
+ status: 200,
87
+ body: File.new(File.join(File.dirname(__FILE__), "fixtures", "images", "newsdict-5d8601394c3f4eea2d7161ab92ab327ac7099e22214c853327011b3a71859b8e.png")),
88
+ headers: {content_type: 'application/html; charset=utf-8'})
@@ -1,63 +1,63 @@
1
1
  RSpec.describe WebStat::Fetch do
2
- [{ fixture: WebStatTestHelper.htmls, class: WebStat::FetchAsHtml},
3
- { fixture: WebStatTestHelper.scheme_and_files, class: WebStat::FetchAsWeb}].each do |fetch|
4
-
2
+ [{fixture: WebStatTestHelper.htmls, class: WebStat::FetchAsHtml},
3
+ {fixture: WebStatTestHelper.scheme_and_files, class: WebStat::FetchAsWeb}].each do |fetch|
4
+
5
5
  it "Get title by #{fetch[:class].to_s}" do
6
6
  fetch[:fixture].each do |fixture|
7
7
  web_stat = fetch[:class].new(fixture)
8
8
  expect(web_stat.title).to eq "gem作成でついまずいたところ"
9
9
  end
10
10
  end
11
-
11
+
12
12
  it "Get site name by #{fetch[:class].to_s}" do
13
13
  fetch[:fixture].each do |fixture|
14
14
  web_stat = fetch[:class].new(fixture)
15
15
  expect(web_stat.site_name).to eq "newsdict.blog"
16
16
  end
17
17
  end
18
-
18
+
19
19
  it "Get Document's content by #{fetch[:class].to_s}" do
20
20
  fetch[:fixture].each do |fixture|
21
21
  web_stat = fetch[:class].new(fixture)
22
22
  expect(web_stat.content).not_to eq nil
23
23
  end
24
24
  end
25
-
25
+
26
26
  it "WebStat content do not include html by #{fetch[:class].to_s}" do
27
27
  fetch[:fixture].each do |fixture|
28
28
  web_stat = fetch[:class].new(fixture)
29
29
  expect(Sanitize.clean(web_stat.content).length).to eq web_stat.content.length
30
30
  end
31
31
  end
32
-
32
+
33
33
  it "Get eyecatch image blob by #{fetch[:class].to_s}" do
34
34
  fetch[:fixture].each do |fixture|
35
35
  web_stat = fetch[:class].new(fixture)
36
- web_stat.url = "https://newsdict.blog"
37
- unless web_stat.stat[:eyecatch_image_path].nil?
38
- image = File.read(web_stat.stat[:eyecatch_image_path])
39
- expect(image.encoding.to_s).to eq("UTF-8")
40
- end
36
+ web_stat.url = "https://newsdict.blog"
37
+ unless web_stat.stat[:eyecatch_image_path].nil?
38
+ image = File.read(web_stat.stat[:eyecatch_image_path])
39
+ expect(image.encoding.to_s).to eq("UTF-8")
40
+ end
41
41
  end
42
42
  end
43
-
43
+
44
44
  it "Get eyecatch image path by #{fetch[:class].to_s}" do
45
45
  fetch[:fixture].each do |fixture|
46
46
  web_stat = fetch[:class].new(fixture)
47
- web_stat.url = "https://newsdict.blog"
47
+ web_stat.url = "https://newsdict.blog"
48
48
  expect(web_stat.eyecatch_image_path).to be_string_or_nil
49
49
  end
50
50
  end
51
-
51
+
52
52
  it "Get local path of eyecatch image by #{fetch[:class].to_s}" do
53
53
  fetch[:fixture].each do |fixture|
54
54
  web_stat = fetch[:class].new(fixture)
55
- web_stat.url = "https://newsdict.blog"
55
+ web_stat.url = "https://newsdict.blog"
56
56
  expect(web_stat.stat[:eyecatch_image_path]).to be_tmp_file_or_nil
57
57
  end
58
58
  end
59
59
  end
60
-
60
+
61
61
  it "WebStat.stat_by_html" do
62
62
  WebStatTestHelper.htmls.each do |fixture|
63
63
  web_stat = WebStat.stat_by_html(fixture, "https://newsdict.blog")
@@ -68,7 +68,7 @@ RSpec.describe WebStat::Fetch do
68
68
  expect(web_stat[:eyecatch_image_path]).to be_tmp_file_or_nil
69
69
  end
70
70
  end
71
-
71
+
72
72
  it "WebStat.stat_by_url" do
73
73
  WebStatTestHelper.scheme_and_files.each do |fixture|
74
74
  web_stat = WebStat.stat_by_url(fixture)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_stat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - yusuke abe
@@ -195,6 +195,7 @@ files:
195
195
  - spec/fixtures/htmls/h1-title.html
196
196
  - spec/fixtures/htmls/image.html
197
197
  - spec/fixtures/images/facebook-3.jpg
198
+ - spec/fixtures/images/newsdict-5d8601394c3f4eea2d7161ab92ab327ac7099e22214c853327011b3a71859b8e.png
198
199
  - spec/spec_helper.rb
199
200
  - spec/web_stat/configure_spec.rb
200
201
  - spec/web_stat/fetch_spec.rb
@@ -229,6 +230,7 @@ test_files:
229
230
  - spec/fixtures/htmls/h1-title.html
230
231
  - spec/fixtures/htmls/image.html
231
232
  - spec/fixtures/images/facebook-3.jpg
233
+ - spec/fixtures/images/newsdict-5d8601394c3f4eea2d7161ab92ab327ac7099e22214c853327011b3a71859b8e.png
232
234
  - spec/spec_helper.rb
233
235
  - spec/web_stat/configure_spec.rb
234
236
  - spec/web_stat/fetch_spec.rb