dash-bees 0.21 → 0.22
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +13 -0
- data/Gemfile +0 -1
- data/dash-bees.gemspec +1 -1
- data/lib/dash-fu/bee.rb +7 -43
- data/lib/dash-fu/bee/fields.rb +17 -0
- data/lib/dash-fu/bee/http_session.rb +44 -0
- data/lib/dash-fu/bee/version.rb +5 -0
- data/lib/dash-fu/bees/backtweets.rb +17 -11
- data/lib/dash-fu/bees/feed.rb +23 -18
- data/lib/dash-fu/bees/feed.yml +1 -1
- data/lib/dash-fu/bees/github.rb +12 -7
- data/lib/dash-fu/bees/github_issues.rb +13 -11
- data/lib/dash-fu/bees/ruby_gems.rb +11 -7
- data/test/backtweets_test.rb +60 -63
- data/test/cassettes/backtweets.yml +2 -2
- data/test/cassettes/feed.yml +1 -0
- data/test/feed_test.rb +82 -80
- data/test/github_issues_test.rb +101 -91
- data/test/github_test.rb +105 -93
- data/test/helpers/activity.rb +5 -1
- data/test/helpers/source.rb +16 -9
- data/test/helpers/test.rb +24 -27
- data/test/ruby_gems_test.rb +72 -67
- data/test/setup.rb +15 -17
- data/test/test.log +1208 -0
- metadata +7 -4
data/test/github_issues_test.rb
CHANGED
@@ -1,195 +1,214 @@
|
|
1
1
|
require_relative "setup"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
setup { source.setup "repo"=>"assaf/vanity" }
|
3
|
+
describe "GitHub Issues" do
|
4
|
+
testing :github_issues
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
describe "setup" do
|
7
|
+
before { source.setup "repo"=>"assaf/vanity" }
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
it "should use repository name" do
|
10
|
+
assert_equal "GitHub issues for assaf/vanity", source.name
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should set origin from repository name" do
|
14
|
+
assert_equal "assaf/vanity", source.origin[:text]
|
15
|
+
assert_equal "http://github.com/assaf/vanity", source.origin[:url]
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should set icon to the octocat" do
|
19
|
+
assert_equal "http://dash-fu.com/images/sources/github.png", source.fields[ICON]
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should accept repository URL" do
|
23
|
+
source.setup "repo"=>"http://github.com/assaf/vanity", "branch"=>"master"
|
24
|
+
assert_equal "GitHub issues for assaf/vanity", source.name
|
25
|
+
end
|
13
26
|
|
14
|
-
|
15
|
-
|
27
|
+
describe "metric" do
|
28
|
+
it "should measure totals" do
|
29
|
+
assert source.metric.totals
|
16
30
|
end
|
17
31
|
|
18
|
-
should
|
19
|
-
assert
|
32
|
+
it "should capture open issues" do
|
33
|
+
assert source.metric.columns.include?(id: "open", label: "Open issues")
|
20
34
|
end
|
21
35
|
|
22
|
-
should
|
23
|
-
assert
|
36
|
+
it "should capture closed issues" do
|
37
|
+
assert source.metric.columns.include?(id: "closed", label: "Closed issues")
|
24
38
|
end
|
25
39
|
end
|
26
40
|
end
|
27
41
|
|
28
42
|
|
29
|
-
|
30
|
-
should
|
31
|
-
|
43
|
+
describe "validation" do
|
44
|
+
it "should raise error if repository name missing" do
|
45
|
+
assert_raises(RuntimeError) { source.setup "repo"=>" " }
|
32
46
|
end
|
33
47
|
|
34
|
-
should
|
35
|
-
|
48
|
+
it "should raise error if repository name not user/repo" do
|
49
|
+
assert_raises(RuntimeError) { source.setup "repo"=>"vanity" }
|
36
50
|
end
|
37
51
|
|
38
|
-
should
|
52
|
+
it "should allow alphanumeric, minus and underscore" do
|
39
53
|
source.setup "repo"=>"assaf/the-vanity_0"
|
40
54
|
assert source.valid?
|
41
55
|
end
|
42
56
|
|
43
|
-
should
|
57
|
+
it "should create valid source" do
|
44
58
|
source.setup "repo"=>"assaf/vanity"
|
45
59
|
assert source.valid?
|
46
60
|
end
|
47
61
|
end
|
48
62
|
|
49
63
|
|
50
|
-
|
51
|
-
|
64
|
+
describe "update" do
|
65
|
+
before { source.setup "repo"=>"assaf/vanity" }
|
52
66
|
|
53
|
-
should
|
67
|
+
it "should handle 404" do
|
54
68
|
stub_request(:get, interactions.first.uri).to_return status: 404
|
55
69
|
stub_request(:get, interactions.second.uri).to_return status: 404
|
56
70
|
source.update
|
57
71
|
assert_equal "Could not find the repository assaf/vanity", source.last_error
|
58
72
|
end
|
59
73
|
|
60
|
-
should
|
74
|
+
it "should handle 401" do
|
61
75
|
stub_request(:get, interactions.first.uri).to_return status: 401
|
62
76
|
stub_request(:get, interactions.second.uri).to_return status: 401
|
63
77
|
source.update
|
64
78
|
assert_equal "You are not authorized to access this repository, or invalid username/password", source.last_error
|
65
79
|
end
|
66
80
|
|
67
|
-
should
|
81
|
+
it "should handle other error" do
|
68
82
|
stub_request(:get, interactions.first.uri).to_return status: 500
|
69
83
|
stub_request(:get, interactions.second.uri).to_return status: 500
|
70
84
|
source.update
|
71
85
|
assert_equal "Last request didn't go as expected, trying again later", source.last_error
|
72
86
|
end
|
73
87
|
|
74
|
-
should
|
88
|
+
it "should handle invlid document entity" do
|
75
89
|
stub_request(:get, interactions.first.uri).to_return body: "Not JSON"
|
76
90
|
stub_request(:get, interactions.last.uri).to_return body: "Not JSON"
|
77
91
|
source.update
|
78
92
|
assert_equal "Last request didn't go as expected, trying again later", source.last_error
|
79
93
|
end
|
80
94
|
|
81
|
-
should
|
95
|
+
it "should capture number of open issues" do
|
82
96
|
source.update
|
83
97
|
assert_equal 9, source.metric.values[:open]
|
84
98
|
end
|
85
99
|
|
86
|
-
should
|
100
|
+
it "should capture number of closed issues" do
|
87
101
|
source.update
|
88
102
|
assert_equal 12, source.metric.values[:closed]
|
89
103
|
end
|
90
104
|
|
91
105
|
|
92
|
-
|
93
|
-
|
94
|
-
|
106
|
+
describe "activity for open issue" do
|
107
|
+
before { source.update }
|
108
|
+
def activity
|
109
|
+
source.activities.first
|
110
|
+
end
|
95
111
|
|
96
|
-
should
|
97
|
-
assert_equal "http://github.com/assaf/vanity/issues#issue/21",
|
112
|
+
it "should capture issue URL" do
|
113
|
+
assert_equal "http://github.com/assaf/vanity/issues#issue/21", activity.url
|
98
114
|
end
|
99
115
|
|
100
|
-
should
|
101
|
-
assert_match /^[0-9a-f]{40}$/,
|
116
|
+
it "should use SHA1 for ID" do
|
117
|
+
assert_match /^[0-9a-f]{40}$/, activity.uid
|
102
118
|
end
|
103
119
|
|
104
|
-
should
|
105
|
-
assert_equal Time.parse("2010/08/19 19:59:31 UTC"),
|
120
|
+
it "should capture issue creation time" do
|
121
|
+
assert_equal Time.parse("2010/08/19 19:59:31 UTC"), activity.timestamp
|
106
122
|
end
|
107
123
|
|
108
|
-
should
|
109
|
-
assert_equal <<-HTML,
|
124
|
+
it "should capture issue title" do
|
125
|
+
assert_equal <<-HTML, activity.html
|
110
126
|
opened <a href="http://github.com/assaf/vanity/issues#issue/21">issue 21</a> on assaf/vanity:
|
111
127
|
<blockquote>Vanity 1.4.0 seems to have issues with Bundler</blockquote>
|
112
128
|
HTML
|
113
129
|
end
|
114
130
|
|
115
|
-
should
|
116
|
-
|
117
|
-
|
131
|
+
it "should tag as issue and open" do
|
132
|
+
assert activity.tags.include?("issue")
|
133
|
+
assert activity.tags.include?("opened")
|
118
134
|
end
|
119
135
|
|
120
|
-
should
|
121
|
-
assert
|
136
|
+
it "should be public" do
|
137
|
+
assert activity.public?
|
122
138
|
end
|
123
139
|
|
124
|
-
|
125
|
-
|
140
|
+
it "should be valid" do
|
141
|
+
assert activity.valid?
|
142
|
+
end
|
126
143
|
|
127
|
-
|
128
|
-
|
144
|
+
describe "person" do
|
145
|
+
it "should be GitHub" do
|
146
|
+
assert_equal "GitHub", person.fullname
|
129
147
|
end
|
130
148
|
|
131
|
-
should
|
132
|
-
|
149
|
+
it "should have site as identity" do
|
150
|
+
assert person.identities.include?("site:github.com")
|
133
151
|
end
|
134
152
|
|
135
|
-
should
|
136
|
-
assert_equal "http://
|
153
|
+
it "should use octocat as photo" do
|
154
|
+
assert_equal "http://dash-fu.com/images/sources/github.png", person.photo_url
|
137
155
|
end
|
138
156
|
end
|
139
157
|
end
|
140
158
|
|
141
|
-
|
142
|
-
|
143
|
-
subject { source.activities.last }
|
159
|
+
describe "activity for closed issue" do
|
160
|
+
before { source.update }
|
144
161
|
|
145
|
-
should
|
146
|
-
assert_equal "http://github.com/assaf/vanity/issues#issue/18",
|
162
|
+
it "should capture issue URL" do
|
163
|
+
assert_equal "http://github.com/assaf/vanity/issues#issue/18", activity.url
|
147
164
|
end
|
148
165
|
|
149
|
-
should
|
150
|
-
assert_match /^[0-9a-f]{40}$/,
|
166
|
+
it "should use SHA1 for ID" do
|
167
|
+
assert_match /^[0-9a-f]{40}$/, activity.uid
|
151
168
|
end
|
152
169
|
|
153
|
-
should
|
154
|
-
assert_equal Time.parse("2010/07/03 02:16:42 UTC"),
|
170
|
+
it "should capture issue closing time" do
|
171
|
+
assert_equal Time.parse("2010/07/03 02:16:42 UTC"), activity.timestamp
|
155
172
|
end
|
156
173
|
|
157
|
-
should
|
158
|
-
assert_equal <<-HTML,
|
174
|
+
it "should capture issue title" do
|
175
|
+
assert_equal <<-HTML, activity.html
|
159
176
|
closed <a href="http://github.com/assaf/vanity/issues#issue/18">issue 18</a> on assaf/vanity:
|
160
177
|
<blockquote>Passwords not supported for the Redis config</blockquote>
|
161
178
|
HTML
|
162
179
|
end
|
163
180
|
|
164
|
-
should
|
165
|
-
|
166
|
-
|
181
|
+
it "should tag as issue and closed" do
|
182
|
+
assert activity.tags.include?("issue")
|
183
|
+
assert activity.tags.include?("closed")
|
167
184
|
end
|
168
185
|
|
169
|
-
should
|
170
|
-
assert
|
186
|
+
it "should be public" do
|
187
|
+
assert activity.public?
|
171
188
|
end
|
172
189
|
|
173
|
-
|
174
|
-
|
190
|
+
it "should be valid" do
|
191
|
+
assert activity.valid?
|
192
|
+
end
|
175
193
|
|
176
|
-
|
177
|
-
|
194
|
+
describe "person" do
|
195
|
+
it "should be GitHub" do
|
196
|
+
assert_equal "GitHub", person.fullname
|
178
197
|
end
|
179
198
|
|
180
|
-
should
|
181
|
-
|
199
|
+
it "should have site as identity" do
|
200
|
+
assert person.identities.include?("site:github.com")
|
182
201
|
end
|
183
202
|
|
184
|
-
should
|
185
|
-
assert_equal "http://
|
203
|
+
it "should use octocat as photo" do
|
204
|
+
assert_equal "http://dash-fu.com/images/sources/github.png", person.photo_url
|
186
205
|
end
|
187
206
|
end
|
188
207
|
end
|
189
208
|
|
190
209
|
|
191
|
-
|
192
|
-
|
210
|
+
describe "repeating" do
|
211
|
+
before do
|
193
212
|
source.update
|
194
213
|
source.activities.clear
|
195
214
|
open = interactions.select { |i| i.uri =~ /open/ }
|
@@ -199,28 +218,19 @@ closed <a href="http://github.com/assaf/vanity/issues#issue/18">issue 18</a> on
|
|
199
218
|
source.update
|
200
219
|
end
|
201
220
|
|
202
|
-
should
|
221
|
+
it "should update open count" do
|
203
222
|
assert_equal 2, source.metric.values[:open]
|
204
223
|
end
|
205
224
|
|
206
|
-
should
|
225
|
+
it "should update closed count" do
|
207
226
|
assert_equal 2, source.metric.values[:closed]
|
208
227
|
end
|
209
228
|
|
210
|
-
should
|
229
|
+
it "should create activity for each issue opened or closed" do
|
211
230
|
assert_equal 2, source.activities.count
|
212
231
|
end
|
213
232
|
end
|
214
233
|
|
215
234
|
end
|
216
235
|
|
217
|
-
|
218
|
-
context "meta" do
|
219
|
-
setup { source.setup "repo"=>"assaf/vanity" }
|
220
|
-
subject { source.meta }
|
221
|
-
|
222
|
-
should "link to repository" do
|
223
|
-
assert_contains subject, title: "On GitHub", url: "http://github.com/assaf/vanity/issues"
|
224
|
-
end
|
225
|
-
end
|
226
236
|
end
|
data/test/github_test.rb
CHANGED
@@ -1,149 +1,164 @@
|
|
1
1
|
require_relative "setup"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
setup { source.setup "repo"=>"assaf/vanity", "branch"=>"master" }
|
3
|
+
describe "GitHub" do
|
4
|
+
testing :github
|
6
5
|
|
7
|
-
|
6
|
+
describe "setup" do
|
7
|
+
before { source.setup "repo"=>"assaf/vanity", "branch"=>"master" }
|
8
|
+
|
9
|
+
it "should use repository name" do
|
10
|
+
assert_equal "GitHub: assaf/vanity", source.name
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should default branch to master" do
|
8
14
|
source.setup "repo"=>"assaf/vanity", "branch"=>" "
|
9
|
-
assert_equal "master", source.
|
15
|
+
assert_equal "master", source.fields["branch"]
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should set origin from repository name" do
|
19
|
+
assert_equal "assaf/vanity", source.origin[:text]
|
20
|
+
assert_equal "http://github.com/assaf/vanity", source.origin[:url]
|
10
21
|
end
|
11
22
|
|
12
|
-
|
13
|
-
|
23
|
+
it "should set icon to the octocat" do
|
24
|
+
assert_equal "http://dash-fu.com/images/sources/github.png", source.fields[ICON]
|
25
|
+
end
|
14
26
|
|
15
|
-
|
16
|
-
|
17
|
-
|
27
|
+
it "should accept repository URL" do
|
28
|
+
source.setup "repo"=>"http://github.com/assaf/vanity", "branch"=>"master"
|
29
|
+
assert_equal "GitHub: assaf/vanity", source.name
|
30
|
+
end
|
18
31
|
|
19
|
-
|
20
|
-
|
32
|
+
describe "metric" do
|
33
|
+
it "should measure totals" do
|
34
|
+
assert source.metric.totals
|
21
35
|
end
|
22
36
|
|
23
|
-
should
|
24
|
-
assert
|
37
|
+
it "should capture commits" do
|
38
|
+
assert source.metric.columns.include?(:id=>"commits", :label=>"Commits")
|
25
39
|
end
|
26
40
|
|
27
|
-
should
|
28
|
-
assert
|
41
|
+
it "should capture watchers" do
|
42
|
+
assert source.metric.columns.include?(:id=>"watchers", :label=>"Watchers")
|
29
43
|
end
|
30
44
|
|
31
|
-
should
|
32
|
-
assert
|
45
|
+
it "should capture forks" do
|
46
|
+
assert source.metric.columns.include?(:id=>"forks", :label=>"Forks")
|
33
47
|
end
|
34
48
|
end
|
35
49
|
end
|
36
50
|
|
37
51
|
|
38
|
-
|
39
|
-
should
|
40
|
-
|
52
|
+
describe "validation" do
|
53
|
+
it "should raise error if repository name missing" do
|
54
|
+
assert_raises(RuntimeError) { source.setup "repo"=>" ", "branch"=>"master" }
|
41
55
|
end
|
42
56
|
|
43
|
-
should
|
44
|
-
|
57
|
+
it "should raise error if repository name not user/repo" do
|
58
|
+
assert_raises(RuntimeError) { source.setup "repo"=>"vanity", "branch"=>"master" }
|
45
59
|
end
|
46
60
|
|
47
|
-
should
|
61
|
+
it "should allow alphanumeric, minus and underscore" do
|
48
62
|
source.setup "repo"=>"assaf/the-vanity_0", "branch"=>"master"
|
49
63
|
assert source.valid?
|
50
64
|
end
|
51
65
|
|
52
|
-
should
|
66
|
+
it "should create valid source" do
|
53
67
|
source.setup "repo"=>"assaf/vanity", "branch"=>"master"
|
54
68
|
assert source.valid?
|
55
69
|
end
|
56
70
|
end
|
57
71
|
|
58
72
|
|
59
|
-
|
60
|
-
|
73
|
+
describe "update" do
|
74
|
+
before { source.setup "repo"=>"assaf/vanity", "branch"=>"master" }
|
61
75
|
|
62
|
-
should
|
76
|
+
it "should handle 404" do
|
63
77
|
stub_request(:get, interactions.first.uri).to_return :status=>404
|
64
78
|
source.update
|
65
79
|
assert_equal "Could not find the repository assaf/vanity", source.last_error
|
66
80
|
end
|
67
81
|
|
68
|
-
should
|
82
|
+
it "should handle 401" do
|
69
83
|
stub_request(:get, interactions.first.uri).to_return :status=>401
|
70
84
|
source.update
|
71
85
|
assert_equal "You are not authorized to access this repository, or invalid username/password", source.last_error
|
72
86
|
end
|
73
87
|
|
74
|
-
should
|
88
|
+
it "should handle other error" do
|
75
89
|
stub_request(:get, interactions.first.uri).to_return :status=>500
|
76
90
|
source.update
|
77
91
|
assert_equal "Last request didn't go as expected, trying again later", source.last_error
|
78
92
|
end
|
79
93
|
|
80
|
-
should
|
94
|
+
it "should handle invlid document entity" do
|
81
95
|
stub_request(:get, interactions.first.uri).to_return :body=>"Not JSON"
|
82
96
|
source.update
|
83
97
|
assert_equal "Last request didn't go as expected, trying again later", source.last_error
|
84
98
|
end
|
85
99
|
|
86
|
-
should
|
100
|
+
it "should capture number of commits" do
|
87
101
|
source.update
|
88
102
|
assert_equal 35, source.metric.values[:commits]
|
89
103
|
end
|
90
104
|
|
91
|
-
should
|
105
|
+
it "should capture number of wacthers" do
|
92
106
|
source.update
|
93
107
|
assert_equal 534, source.metric.values[:watchers]
|
94
108
|
end
|
95
109
|
|
96
|
-
should
|
110
|
+
it "should capture number of forks" do
|
97
111
|
source.update
|
98
112
|
assert_equal 36, source.metric.values[:forks]
|
99
113
|
end
|
100
114
|
|
101
115
|
|
102
|
-
|
103
|
-
|
104
|
-
subject { source.activity }
|
116
|
+
describe "activity" do
|
117
|
+
before { source.update }
|
105
118
|
|
106
|
-
should
|
107
|
-
assert_equal "http://github.com/assaf/vanity/commit/dd154a9fdd2ac534b62b55b8acac2fd092d6543a",
|
119
|
+
it "should capture commit URL" do
|
120
|
+
assert_equal "http://github.com/assaf/vanity/commit/dd154a9fdd2ac534b62b55b8acac2fd092d6543a", activity.url
|
108
121
|
end
|
109
122
|
|
110
|
-
should
|
111
|
-
assert_equal "dd154a9fdd2ac534b62b55b8acac2fd092d6543a",
|
123
|
+
it "should capture commit SHA" do
|
124
|
+
assert_equal "dd154a9fdd2ac534b62b55b8acac2fd092d6543a", activity.uid
|
112
125
|
end
|
113
126
|
|
114
|
-
should
|
115
|
-
assert_equal Time.parse("2010-08-06T00:18:01-07:00 UTC").utc,
|
127
|
+
it "should capture timestamp" do
|
128
|
+
assert_equal Time.parse("2010-08-06T00:18:01-07:00 UTC").utc, activity.timestamp
|
116
129
|
end
|
117
130
|
|
118
|
-
should
|
119
|
-
assert_match %{pushed to master at <a href="http://github.com/assaf/vanity">assaf/vanity</a>:},
|
131
|
+
it "should capture push" do
|
132
|
+
assert_match %{pushed to master at <a href="http://github.com/assaf/vanity">assaf/vanity</a>:}, activity.html
|
120
133
|
end
|
121
134
|
|
122
|
-
should
|
123
|
-
|
135
|
+
it "should tag as push" do
|
136
|
+
assert activity.tags.include?("push")
|
124
137
|
end
|
125
138
|
|
126
|
-
should
|
127
|
-
|
128
|
-
assert subject.valid?
|
139
|
+
it "should be public" do
|
140
|
+
assert activity.public?
|
129
141
|
end
|
130
142
|
|
131
|
-
|
132
|
-
|
143
|
+
it "should be valid" do
|
144
|
+
activity.validate
|
145
|
+
assert activity.valid?
|
146
|
+
end
|
133
147
|
|
134
|
-
|
135
|
-
|
148
|
+
describe "person" do
|
149
|
+
it "should capture full name" do
|
150
|
+
assert_equal "Assaf Arkin", person.fullname
|
136
151
|
end
|
137
152
|
|
138
|
-
should
|
139
|
-
assert_equal "assaf@labnotes.org",
|
153
|
+
it "should capture email" do
|
154
|
+
assert_equal "assaf@labnotes.org", person.email
|
140
155
|
end
|
141
156
|
|
142
|
-
should
|
143
|
-
|
157
|
+
it "should capture identity" do
|
158
|
+
assert person.identities.include?("github.com:assaf")
|
144
159
|
end
|
145
160
|
|
146
|
-
should
|
161
|
+
it "should not trip on empty login" do
|
147
162
|
commits = interactions.select { |i| i.uri =~ /commits\/list/ }
|
148
163
|
stub_request(:get, commits.first.uri).to_return :body=>commits.last.response.body
|
149
164
|
source.update
|
@@ -153,19 +168,21 @@ test DashFu::Bee::Github do
|
|
153
168
|
end
|
154
169
|
end
|
155
170
|
|
156
|
-
|
157
|
-
subject
|
171
|
+
describe "commit message" do
|
172
|
+
def subject
|
173
|
+
(Nokogiri::HTML(source.activity.html)/"blockquote").map(&:inner_text).join("\n")
|
174
|
+
end
|
158
175
|
|
159
|
-
should
|
176
|
+
it "should start with commit SHA" do
|
160
177
|
assert_match /^dd154a9 /, subject
|
161
178
|
end
|
162
179
|
|
163
|
-
should
|
180
|
+
it "should include first 50 characters of message" do
|
164
181
|
with_message "This is a very long message and we're only going to show the first 50 characters of it."
|
165
182
|
assert_equal 50, subject[/\s(.*)/, 1].length
|
166
183
|
end
|
167
184
|
|
168
|
-
should
|
185
|
+
it "should use only first line of message" do
|
169
186
|
with_message "This message is made\nof two lines"
|
170
187
|
assert_match "This message is made", subject[/\s(.*)/, 1]
|
171
188
|
end
|
@@ -180,25 +197,25 @@ test DashFu::Bee::Github do
|
|
180
197
|
end
|
181
198
|
end
|
182
199
|
|
183
|
-
|
184
|
-
|
200
|
+
describe "sequential commits" do
|
201
|
+
before do
|
185
202
|
source.activities.clear
|
186
203
|
interaction = interactions.select { |i| i.uri =~ /commits\/list/ }.last
|
187
204
|
stub_request(:get, interaction.uri).to_return :body=>interaction.response.body
|
188
205
|
source.update
|
206
|
+
@message = (Nokogiri::HTML(source.activity.html)/"blockquote")
|
189
207
|
end
|
190
|
-
subject { (Nokogiri::HTML(source.activity.html)/"blockquote") }
|
191
208
|
|
192
|
-
should
|
209
|
+
it "should show as multiple activities" do
|
193
210
|
assert_equal 4, source.activities.count # 4 commits -> 3 activities
|
194
211
|
end
|
195
212
|
|
196
|
-
should
|
197
|
-
assert_equal 2,
|
213
|
+
it "should merge related commits into single activity" do
|
214
|
+
assert_equal 2, @message.length # last one has two commits
|
198
215
|
end
|
199
216
|
|
200
|
-
should
|
201
|
-
first, second =
|
217
|
+
it "should merge related commits in order they were listed" do
|
218
|
+
first, second = @message.map { |bq| bq.inner_text.strip }
|
202
219
|
assert_equal "cc156a9 Most recent commit", first
|
203
220
|
assert_equal "dd156a9 Not most recent commit", second
|
204
221
|
end
|
@@ -207,8 +224,8 @@ test DashFu::Bee::Github do
|
|
207
224
|
end
|
208
225
|
|
209
226
|
|
210
|
-
|
211
|
-
|
227
|
+
describe "repeating" do
|
228
|
+
before do
|
212
229
|
source.update
|
213
230
|
repo = interactions.select { |i| i.uri =~ /repos\/show/ }
|
214
231
|
stub_request(:get, repo.first.uri).to_return :body=>repo.last.response.body
|
@@ -217,15 +234,15 @@ test DashFu::Bee::Github do
|
|
217
234
|
source.update
|
218
235
|
end
|
219
236
|
|
220
|
-
should
|
237
|
+
it "should update watchers" do
|
221
238
|
assert_equal 555, source.metric.values[:watchers]
|
222
239
|
end
|
223
240
|
|
224
|
-
should
|
241
|
+
it "should update forks" do
|
225
242
|
assert_equal 38, source.metric.values[:forks]
|
226
243
|
end
|
227
244
|
|
228
|
-
should
|
245
|
+
it "should capture new number of commits" do
|
229
246
|
assert_equal 40, source.metric.values[:commits]
|
230
247
|
end
|
231
248
|
end
|
@@ -233,29 +250,24 @@ test DashFu::Bee::Github do
|
|
233
250
|
end
|
234
251
|
|
235
252
|
|
236
|
-
|
237
|
-
|
238
|
-
subject { source.meta }
|
239
|
-
|
240
|
-
should "link to repository" do
|
241
|
-
assert_contains subject, :title=>"Repository", :text=>"assaf/vanity", :url=>"http://github.com/assaf/vanity"
|
242
|
-
end
|
253
|
+
describe "meta" do
|
254
|
+
before { source.setup "repo"=>"assaf/vanity", "branch"=>"master" }
|
243
255
|
|
244
|
-
should
|
245
|
-
|
256
|
+
it "should include project description" do
|
257
|
+
assert source.meta.include?(:text=>"Experiment Driven Development for Ruby")
|
246
258
|
end
|
247
259
|
|
248
|
-
should
|
249
|
-
|
260
|
+
it "should link to project home page" do
|
261
|
+
assert source.meta.include?(:title=>"Home page", :url=>"http://vanity.labnotes.org")
|
250
262
|
end
|
251
263
|
|
252
|
-
should
|
253
|
-
|
264
|
+
it "should list branch name" do
|
265
|
+
assert source.meta.include?(:title=>"Branch", :text=>"master")
|
254
266
|
end
|
255
267
|
|
256
|
-
should
|
257
|
-
|
258
|
-
:url=>"http://github.com/assaf/vanity/commit/dd154a9fdd2ac534b62b55b8acac2fd092d6543a"
|
268
|
+
it "should show last commit message" do
|
269
|
+
assert source.meta.include?(:title=>"Commit", :text=>"Gemfile changes necessary to pass test suite.",
|
270
|
+
:url=>"http://github.com/assaf/vanity/commit/dd154a9fdd2ac534b62b55b8acac2fd092d6543a")
|
259
271
|
end
|
260
272
|
end
|
261
273
|
end
|