onebox 1.8.12 → 1.8.13

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: 7e49b29d9f523548133ecd1ab5e06b38d0095de7
4
- data.tar.gz: 8a019562dfac53eaabb811217cbbe1d9b71118e3
3
+ metadata.gz: 881354a49c26f3ff8f7f96286bfda2f1fe313cf5
4
+ data.tar.gz: ff63ab334806ad83ba234af67d29eff74a40c0b2
5
5
  SHA512:
6
- metadata.gz: 739d913e0759b3a3c3f4280f215125bce634303af0f2e6154e192e2deca6b4b4f2a9f02069653f5f2c2e1c06225cb271862e289d4c4fe6f8eddc48c49ad81f73
7
- data.tar.gz: aeef0ad8e417d3eb127f7d1f62b8dfc0792700f17c9a023ce1ee0235798a0b96ab348340cb534ec6a1a9de1ec6331318c5ee22b3f312e02654fc10d8aae163ba
6
+ metadata.gz: c7ce9b381f54dfa5c1ae033ee67c7c824a026b2eedb91e7569668e105745dc0e1158a683baeb5582850c79016c0d0f3178c17d155fa3eea3d2b9334f8fc70e5e
7
+ data.tar.gz: 4099701a95bc9eb0c7a5d39df03f062f794f81c63aeb69ec96b489f193d3034e4d270dabeedbcc00972cbfd919b05f703fdb1f5b3303707a49cc80da7e24e7a4
@@ -5,7 +5,7 @@ module Onebox
5
5
  include LayoutSupport
6
6
  include JSON
7
7
 
8
- matches_regexp Regexp.new("^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/commit/")
8
+ matches_regexp Regexp.new("^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/commits?/")
9
9
  always_https
10
10
 
11
11
  def url
@@ -15,7 +15,13 @@ module Onebox
15
15
  private
16
16
 
17
17
  def match
18
- @match ||= @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/commit/(?<sha>[^/]+)})
18
+ return @match if @match
19
+
20
+ @match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/commits?/(?<sha>[^/]+)})
21
+
22
+ @match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/pull/(?<pr>[^/]+)/commits?/(?<sha>[^/]+)}) if @match.nil?
23
+
24
+ @match
19
25
  end
20
26
 
21
27
  def data
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.8.12"
2
+ VERSION = "1.8.13"
3
3
  end
@@ -1,53 +1,108 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Onebox::Engine::GithubCommitOnebox do
4
- before(:all) do
5
- @link = "https://github.com/discourse/discourse/commit/803d023e2307309f8b776ab3b8b7e38ba91c0919"
6
- @uri = "https://api.github.com/repos/discourse/discourse/commits/803d023e2307309f8b776ab3b8b7e38ba91c0919"
7
- end
8
-
9
- include_context "engines"
10
- it_behaves_like "an engine"
11
4
 
12
- describe "#to_html" do
13
- it "includes owner" do
14
- expect(html).to include("discourse")
5
+ describe "regular commit url" do
6
+ before(:all) do
7
+ @link = "https://github.com/discourse/discourse/commit/803d023e2307309f8b776ab3b8b7e38ba91c0919"
8
+ @uri = "https://api.github.com/repos/discourse/discourse/commits/803d023e2307309f8b776ab3b8b7e38ba91c0919"
15
9
  end
16
10
 
17
- it "includes repository name" do
18
- expect(html).to include("discourse")
19
- end
11
+ include_context "engines"
12
+ it_behaves_like "an engine"
20
13
 
21
- it "includes commit sha" do
22
- expect(html).to include("803d023e2307309f8b776ab3b8b7e38ba91c0919")
23
- end
14
+ describe "#to_html" do
15
+ it "includes owner" do
16
+ expect(html).to include("discourse")
17
+ end
24
18
 
25
- it "includes commit author gravatar" do
26
- expect(html).to include("2F7d3010c11d08cf990b7614d2c2ca9098.png")
27
- end
19
+ it "includes repository name" do
20
+ expect(html).to include("discourse")
21
+ end
28
22
 
29
- it "includes commit message" do
30
- expect(html).to include("Fixed GitHub auth")
31
- end
23
+ it "includes commit sha" do
24
+ expect(html).to include("803d023e2307309f8b776ab3b8b7e38ba91c0919")
25
+ end
32
26
 
33
- it "includes commit author" do
34
- expect(html).to include("SamSaffron")
35
- end
27
+ it "includes commit author gravatar" do
28
+ expect(html).to include("2F7d3010c11d08cf990b7614d2c2ca9098.png")
29
+ end
36
30
 
37
- it "includes commit time and date" do
38
- expect(html).to include("02:03AM - 02 Aug 13")
39
- end
31
+ it "includes commit message" do
32
+ expect(html).to include("Fixed GitHub auth")
33
+ end
34
+
35
+ it "includes commit author" do
36
+ expect(html).to include("SamSaffron")
37
+ end
38
+
39
+ it "includes commit time and date" do
40
+ expect(html).to include("02:03AM - 02 Aug 13")
41
+ end
42
+
43
+ it "includes number of files changed" do
44
+ expect(html).to include("1 file")
45
+ end
46
+
47
+ it "includes number of additions" do
48
+ expect(html).to include("18 additions")
49
+ end
40
50
 
41
- it "includes number of files changed" do
42
- expect(html).to include("1 file")
51
+ it "includes number of deletions" do
52
+ expect(html).to include("2 deletions")
53
+ end
43
54
  end
55
+ end
44
56
 
45
- it "includes number of additions" do
46
- expect(html).to include("18 additions")
57
+ describe "PR with commit URL" do
58
+ before(:all) do
59
+ @link = "https://github.com/discourse/discourse/pull/4662/commits/803d023e2307309f8b776ab3b8b7e38ba91c0919"
60
+ @uri = "https://api.github.com/repos/discourse/discourse/commits/803d023e2307309f8b776ab3b8b7e38ba91c0919"
47
61
  end
48
62
 
49
- it "includes number of deletions" do
50
- expect(html).to include("2 deletions")
63
+ include_context "engines"
64
+ it_behaves_like "an engine"
65
+
66
+ describe "#to_html" do
67
+ it "includes owner" do
68
+ expect(html).to include("discourse")
69
+ end
70
+
71
+ it "includes repository name" do
72
+ expect(html).to include("discourse")
73
+ end
74
+
75
+ it "includes commit sha" do
76
+ expect(html).to include("803d023e2307309f8b776ab3b8b7e38ba91c0919")
77
+ end
78
+
79
+ it "includes commit author gravatar" do
80
+ expect(html).to include("2F7d3010c11d08cf990b7614d2c2ca9098.png")
81
+ end
82
+
83
+ it "includes commit message" do
84
+ expect(html).to include("Fixed GitHub auth")
85
+ end
86
+
87
+ it "includes commit author" do
88
+ expect(html).to include("SamSaffron")
89
+ end
90
+
91
+ it "includes commit time and date" do
92
+ expect(html).to include("02:03AM - 02 Aug 13")
93
+ end
94
+
95
+ it "includes number of files changed" do
96
+ expect(html).to include("1 file")
97
+ end
98
+
99
+ it "includes number of additions" do
100
+ expect(html).to include("18 additions")
101
+ end
102
+
103
+ it "includes number of deletions" do
104
+ expect(html).to include("2 deletions")
105
+ end
51
106
  end
52
107
  end
53
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.12
4
+ version: 1.8.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-06-09 00:00:00.000000000 Z
13
+ date: 2017-06-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json