omg_pull_request 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/.gitignore +47 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +68 -0
  4. data/LICENSE +22 -0
  5. data/README.md +66 -0
  6. data/Rakefile +12 -0
  7. data/bin/omg_pull_request +13 -0
  8. data/lib/omg_pull_request.rb +32 -0
  9. data/lib/omg_pull_request/aws/store.rb +30 -0
  10. data/lib/omg_pull_request/configuration.rb +55 -0
  11. data/lib/omg_pull_request/context.rb +29 -0
  12. data/lib/omg_pull_request/git_client.rb +31 -0
  13. data/lib/omg_pull_request/github_wrapper.rb +50 -0
  14. data/lib/omg_pull_request/lolcommits.rb +39 -0
  15. data/lib/omg_pull_request/notifications.rb +66 -0
  16. data/lib/omg_pull_request/prowl.rb +77 -0
  17. data/lib/omg_pull_request/test_logger.rb +20 -0
  18. data/lib/omg_pull_request/test_runner.rb +22 -0
  19. data/lib/omg_pull_request/test_runner/base.rb +128 -0
  20. data/lib/omg_pull_request/test_runner/rails.rb +19 -0
  21. data/lib/omg_pull_request/test_runner/ruby.rb +9 -0
  22. data/lib/omg_pull_request/version.rb +3 -0
  23. data/locales/en.yml +23 -0
  24. data/locales/omg.yml +20 -0
  25. data/omg_pull_request.gemspec +26 -0
  26. data/test/fixtures/comments +431 -0
  27. data/test/fixtures/config.yml +20 -0
  28. data/test/fixtures/create_comment +24 -0
  29. data/test/fixtures/github_commits +183 -0
  30. data/test/fixtures/kenmazaika +30 -0
  31. data/test/fixtures/pull_requests +151 -0
  32. data/test/mocks/git_client.rb +6 -0
  33. data/test/mocks/pull_request.rb +38 -0
  34. data/test/omg_pull_request/.gitkeep +0 -0
  35. data/test/test_helper.rb +53 -0
  36. data/test/units/omg_pull_request/aws/store_test.rb +22 -0
  37. data/test/units/omg_pull_request/github_wrapper_test.rb +43 -0
  38. data/test/units/omg_pull_request/lolcommits_test.rb +42 -0
  39. data/test/units/omg_pull_request/notifications_test.rb +125 -0
  40. data/test/units/omg_pull_request/prowl_test.rb +51 -0
  41. data/test/units/omg_pull_request/test_runner/base_test.rb +58 -0
  42. metadata +183 -0
@@ -0,0 +1,24 @@
1
+ HTTP/1.1 201 Created
2
+ Server: nginx/0.8.52
3
+ Date: Fri, 17 Dec 2010 02:02:58 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ Expires: Fri, 17 Dec 2010 02:02:58 UTC
7
+ Cache-Control: no-cache; private; no-store
8
+ Pragma: no-cache
9
+
10
+ {
11
+ "body": "omg",
12
+ "user": {
13
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
14
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
15
+ "login": "kenmazaika",
16
+ "url": "https://api.github.com/users/kenmazaika",
17
+ "id": 233615
18
+ },
19
+ "created_at": "2012-08-27T06:12:24Z",
20
+ "url": "https://api.github.com/repos/kenmazaika/pictures/issues/comments/8047694",
21
+ "updated_at": "2012-08-27T06:12:24Z",
22
+ "id": 8047694
23
+ }
24
+
@@ -0,0 +1,183 @@
1
+ HTTP/1.1 200 Internal Server Error
2
+ Server: nginx/0.8.52
3
+ Date: Fri, 17 Dec 2010 02:02:58 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ Expires: Fri, 17 Dec 2010 02:02:58 UTC
7
+ Cache-Control: no-cache; private; no-store
8
+ Pragma: no-cache
9
+
10
+ [
11
+ {
12
+ "author": {
13
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
14
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
15
+ "login": "kenmazaika",
16
+ "url": "https://api.github.com/users/kenmazaika",
17
+ "id": 233615
18
+ },
19
+ "commit": {
20
+ "author": {
21
+ "date": "2012-05-22T07:50:31-07:00",
22
+ "name": "Ken Mazaika",
23
+ "email": "kenmazaika@gmail.com"
24
+ },
25
+ "tree": {
26
+ "sha": "5234cd7eb5338fbc4cde22ec8c6e70190033bf69",
27
+ "url": "https://api.github.com/repos/kenmazaika/pictures/git/trees/5234cd7eb5338fbc4cde22ec8c6e70190033bf69"
28
+ },
29
+ "comment_count": 0,
30
+ "message": "trivial change",
31
+ "url": "https://api.github.com/repos/kenmazaika/pictures/git/commits/c129a13a1c66ee48d5fad9c1714917cbda48e685",
32
+ "committer": {
33
+ "date": "2012-05-22T07:50:31-07:00",
34
+ "name": "Ken Mazaika",
35
+ "email": "kenmazaika@gmail.com"
36
+ }
37
+ },
38
+ "sha": "c129a13a1c66ee48d5fad9c1714917cbda48e685",
39
+ "parents": [
40
+ {
41
+ "sha": "e7212923fbea50c72f3122ac05d954cfdcf6761e",
42
+ "url": "https://api.github.com/repos/kenmazaika/pictures/commits/e7212923fbea50c72f3122ac05d954cfdcf6761e"
43
+ }
44
+ ],
45
+ "url": "https://api.github.com/repos/kenmazaika/pictures/commits/c129a13a1c66ee48d5fad9c1714917cbda48e685",
46
+ "committer": {
47
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
48
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
49
+ "login": "kenmazaika",
50
+ "url": "https://api.github.com/users/kenmazaika",
51
+ "id": 233615
52
+ }
53
+ },
54
+ {
55
+ "author": {
56
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
57
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
58
+ "login": "kenmazaika",
59
+ "url": "https://api.github.com/users/kenmazaika",
60
+ "id": 233615
61
+ },
62
+ "commit": {
63
+ "author": {
64
+ "date": "2012-06-21T08:33:44-07:00",
65
+ "name": "Ken Mazaika",
66
+ "email": "kenmazaika@gmail.com"
67
+ },
68
+ "tree": {
69
+ "sha": "1af721d2c18062efcc65b24757d76374df335cf0",
70
+ "url": "https://api.github.com/repos/kenmazaika/pictures/git/trees/1af721d2c18062efcc65b24757d76374df335cf0"
71
+ },
72
+ "comment_count": 0,
73
+ "message": "Use Mysql2 instead of sqlite, this should work on ci but not locally.",
74
+ "url": "https://api.github.com/repos/kenmazaika/pictures/git/commits/dcc1e9847ff1cb6b1e564afcd5904a658f5271b0",
75
+ "committer": {
76
+ "date": "2012-06-21T08:33:44-07:00",
77
+ "name": "Ken Mazaika",
78
+ "email": "kenmazaika@gmail.com"
79
+ }
80
+ },
81
+ "sha": "dcc1e9847ff1cb6b1e564afcd5904a658f5271b0",
82
+ "parents": [
83
+ {
84
+ "sha": "c129a13a1c66ee48d5fad9c1714917cbda48e685",
85
+ "url": "https://api.github.com/repos/kenmazaika/pictures/commits/c129a13a1c66ee48d5fad9c1714917cbda48e685"
86
+ }
87
+ ],
88
+ "url": "https://api.github.com/repos/kenmazaika/pictures/commits/dcc1e9847ff1cb6b1e564afcd5904a658f5271b0",
89
+ "committer": {
90
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
91
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
92
+ "login": "kenmazaika",
93
+ "url": "https://api.github.com/users/kenmazaika",
94
+ "id": 233615
95
+ }
96
+ },
97
+ {
98
+ "author": {
99
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
100
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
101
+ "login": "kenmazaika",
102
+ "url": "https://api.github.com/users/kenmazaika",
103
+ "id": 233615
104
+ },
105
+ "commit": {
106
+ "author": {
107
+ "date": "2012-06-21T08:39:25-07:00",
108
+ "name": "Ken Mazaika",
109
+ "email": "kenmazaika@gmail.com"
110
+ },
111
+ "tree": {
112
+ "sha": "2bb509c6afd4d3af1f73cda98bf267901486faf5",
113
+ "url": "https://api.github.com/repos/kenmazaika/pictures/git/trees/2bb509c6afd4d3af1f73cda98bf267901486faf5"
114
+ },
115
+ "comment_count": 0,
116
+ "message": "Update gems",
117
+ "url": "https://api.github.com/repos/kenmazaika/pictures/git/commits/c204cee08e0fb948e74e47ed973d507af5dabec5",
118
+ "committer": {
119
+ "date": "2012-06-21T08:39:25-07:00",
120
+ "name": "Ken Mazaika",
121
+ "email": "kenmazaika@gmail.com"
122
+ }
123
+ },
124
+ "sha": "c204cee08e0fb948e74e47ed973d507af5dabec5",
125
+ "parents": [
126
+ {
127
+ "sha": "dcc1e9847ff1cb6b1e564afcd5904a658f5271b0",
128
+ "url": "https://api.github.com/repos/kenmazaika/pictures/commits/dcc1e9847ff1cb6b1e564afcd5904a658f5271b0"
129
+ }
130
+ ],
131
+ "url": "https://api.github.com/repos/kenmazaika/pictures/commits/c204cee08e0fb948e74e47ed973d507af5dabec5",
132
+ "committer": {
133
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
134
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
135
+ "login": "kenmazaika",
136
+ "url": "https://api.github.com/users/kenmazaika",
137
+ "id": 233615
138
+ }
139
+ },
140
+ {
141
+ "author": {
142
+ "gravatar_id": "c23f2b82d17d2efa8f56c19d586bfd7e",
143
+ "avatar_url": "https://secure.gravatar.com/avatar/c23f2b82d17d2efa8f56c19d586bfd7e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
144
+ "login": "jthorne",
145
+ "url": "https://api.github.com/users/jthorne",
146
+ "id": 1045155
147
+ },
148
+ "commit": {
149
+ "author": {
150
+ "date": "2012-08-03T15:03:17-07:00",
151
+ "name": "Jack Thorne",
152
+ "email": "jthorne@where.com"
153
+ },
154
+ "tree": {
155
+ "sha": "54edce4fcea874af636cb7fa7b0e6511d91224ac",
156
+ "url": "https://api.github.com/repos/kenmazaika/pictures/git/trees/54edce4fcea874af636cb7fa7b0e6511d91224ac"
157
+ },
158
+ "comment_count": 0,
159
+ "message": "nothing",
160
+ "url": "https://api.github.com/repos/kenmazaika/pictures/git/commits/ad0a65aeecaba3a1a487f7d066bab25209086b8c",
161
+ "committer": {
162
+ "date": "2012-08-03T15:03:17-07:00",
163
+ "name": "Jack Thorne",
164
+ "email": "jthorne@where.com"
165
+ }
166
+ },
167
+ "sha": "ad0a65aeecaba3a1a487f7d066bab25209086b8c",
168
+ "parents": [
169
+ {
170
+ "sha": "c204cee08e0fb948e74e47ed973d507af5dabec5",
171
+ "url": "https://api.github.com/repos/kenmazaika/pictures/commits/c204cee08e0fb948e74e47ed973d507af5dabec5"
172
+ }
173
+ ],
174
+ "url": "https://api.github.com/repos/kenmazaika/pictures/commits/ad0a65aeecaba3a1a487f7d066bab25209086b8c",
175
+ "committer": {
176
+ "gravatar_id": "c23f2b82d17d2efa8f56c19d586bfd7e",
177
+ "avatar_url": "https://secure.gravatar.com/avatar/c23f2b82d17d2efa8f56c19d586bfd7e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
178
+ "login": "jthorne",
179
+ "url": "https://api.github.com/users/jthorne",
180
+ "id": 1045155
181
+ }
182
+ }
183
+ ]
@@ -0,0 +1,30 @@
1
+ HTTP/1.1 200 Internal Server Error
2
+ Server: nginx/0.8.52
3
+ Date: Fri, 17 Dec 2010 02:02:58 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ Expires: Fri, 17 Dec 2010 02:02:58 UTC
7
+ Cache-Control: no-cache; private; no-store
8
+ Pragma: no-cache
9
+
10
+ {
11
+ "type": "User",
12
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
13
+ "html_url": "https://github.com/kenmazaika",
14
+ "company": null,
15
+ "following": 1,
16
+ "location": null,
17
+ "public_repos": 25,
18
+ "created_at": "2010-03-30T19:31:12Z",
19
+ "hireable": false,
20
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
21
+ "login": "kenmazaika",
22
+ "public_gists": 25,
23
+ "followers": 9,
24
+ "blog": null,
25
+ "name": null,
26
+ "bio": "",
27
+ "url": "https://api.github.com/users/kenmazaika",
28
+ "email": "kenmazaika@gmail.com",
29
+ "id": 233615
30
+ }
@@ -0,0 +1,151 @@
1
+ HTTP/1.1 200 Success
2
+ Server: nginx/0.8.52
3
+ Date: Fri, 17 Dec 2010 02:02:58 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ Expires: Fri, 17 Dec 2010 02:02:58 UTC
7
+ Cache-Control: no-cache; private; no-store
8
+ Pragma: no-cache
9
+
10
+ [
11
+ {
12
+ "_links": {
13
+ "self": {
14
+ "href": "https://api.github.com/repos/kenmazaika/pictures/pulls/2"
15
+ },
16
+ "html": {
17
+ "href": "https://github.com/kenmazaika/pictures/pull/2"
18
+ },
19
+ "comments": {
20
+ "href": "https://api.github.com/repos/kenmazaika/pictures/issues/2/comments"
21
+ },
22
+ "issue": {
23
+ "href": "https://api.github.com/repos/kenmazaika/pictures/issues/2"
24
+ },
25
+ "review_comments": {
26
+ "href": "https://api.github.com/repos/kenmazaika/pictures/pulls/2/comments"
27
+ }
28
+ },
29
+ "state": "open",
30
+ "issue_url": "https://github.com/kenmazaika/pictures/issues/2",
31
+ "milestone": null,
32
+ "closed_at": null,
33
+ "number": 2,
34
+ "html_url": "https://github.com/kenmazaika/pictures/pull/2",
35
+ "merged_at": null,
36
+ "body": "",
37
+ "user": {
38
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
39
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
40
+ "login": "kenmazaika",
41
+ "url": "https://api.github.com/users/kenmazaika",
42
+ "id": 233615
43
+ },
44
+ "title": "Omg",
45
+ "assignee": null,
46
+ "created_at": "2012-08-25T21:43:20Z",
47
+ "patch_url": "https://github.com/kenmazaika/pictures/pull/2.patch",
48
+ "diff_url": "https://github.com/kenmazaika/pictures/pull/2.diff",
49
+ "base": {
50
+ "label": "kenmazaika:master",
51
+ "sha": "e7212923fbea50c72f3122ac05d954cfdcf6761e",
52
+ "user": {
53
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
54
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
55
+ "login": "kenmazaika",
56
+ "url": "https://api.github.com/users/kenmazaika",
57
+ "id": 233615
58
+ },
59
+ "ref": "master",
60
+ "repo": {
61
+ "has_wiki": true,
62
+ "clone_url": "https://github.com/kenmazaika/pictures.git",
63
+ "pushed_at": "2012-08-03T22:08:21Z",
64
+ "forks": 1,
65
+ "watchers": 1,
66
+ "git_url": "git://github.com/kenmazaika/pictures.git",
67
+ "html_url": "https://github.com/kenmazaika/pictures",
68
+ "owner": {
69
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
70
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
71
+ "login": "kenmazaika",
72
+ "url": "https://api.github.com/users/kenmazaika",
73
+ "id": 233615
74
+ },
75
+ "full_name": "kenmazaika/pictures",
76
+ "open_issues": 1,
77
+ "watchers_count": 1,
78
+ "homepage": "http://cold-sunset-3667.heroku.com/",
79
+ "open_issues_count": 1,
80
+ "mirror_url": null,
81
+ "has_issues": true,
82
+ "language": "Ruby",
83
+ "created_at": "2012-04-02T00:55:07Z",
84
+ "forks_count": 1,
85
+ "has_downloads": true,
86
+ "size": 17952,
87
+ "fork": false,
88
+ "description": "The example project for file_upload_cache",
89
+ "svn_url": "https://github.com/kenmazaika/pictures",
90
+ "ssh_url": "git@github.com:kenmazaika/pictures.git",
91
+ "name": "pictures",
92
+ "url": "https://api.github.com/repos/kenmazaika/pictures",
93
+ "private": false,
94
+ "updated_at": "2012-08-03T22:08:23Z",
95
+ "id": 3896551
96
+ }
97
+ },
98
+ "url": "https://api.github.com/repos/kenmazaika/pictures/pulls/2",
99
+ "updated_at": "2012-08-27T06:12:24Z",
100
+ "id": 2162200,
101
+ "head": {
102
+ "label": "kenmazaika:omg",
103
+ "sha": "ad0a65aeecaba3a1a487f7d066bab25209086b8c",
104
+ "user": {
105
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
106
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
107
+ "login": "kenmazaika",
108
+ "url": "https://api.github.com/users/kenmazaika",
109
+ "id": 233615
110
+ },
111
+ "ref": "omg",
112
+ "repo": {
113
+ "has_wiki": true,
114
+ "clone_url": "https://github.com/kenmazaika/pictures.git",
115
+ "pushed_at": "2012-08-03T22:08:21Z",
116
+ "forks": 1,
117
+ "watchers": 1,
118
+ "git_url": "git://github.com/kenmazaika/pictures.git",
119
+ "html_url": "https://github.com/kenmazaika/pictures",
120
+ "owner": {
121
+ "gravatar_id": "2a9b8f5273d934fe57daa8cf54c3a017",
122
+ "avatar_url": "https://secure.gravatar.com/avatar/2a9b8f5273d934fe57daa8cf54c3a017?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
123
+ "login": "kenmazaika",
124
+ "url": "https://api.github.com/users/kenmazaika",
125
+ "id": 233615
126
+ },
127
+ "full_name": "kenmazaika/pictures",
128
+ "open_issues": 1,
129
+ "watchers_count": 1,
130
+ "homepage": "http://cold-sunset-3667.heroku.com/",
131
+ "open_issues_count": 1,
132
+ "mirror_url": null,
133
+ "has_issues": true,
134
+ "language": "Ruby",
135
+ "created_at": "2012-04-02T00:55:07Z",
136
+ "forks_count": 1,
137
+ "has_downloads": true,
138
+ "size": 17952,
139
+ "fork": false,
140
+ "description": "The example project for file_upload_cache",
141
+ "svn_url": "https://github.com/kenmazaika/pictures",
142
+ "ssh_url": "git@github.com:kenmazaika/pictures.git",
143
+ "name": "pictures",
144
+ "url": "https://api.github.com/repos/kenmazaika/pictures",
145
+ "private": false,
146
+ "updated_at": "2012-08-03T22:08:23Z",
147
+ "id": 3896551
148
+ }
149
+ }
150
+ }
151
+ ]
@@ -0,0 +1,6 @@
1
+ class MockGitClient
2
+
3
+ def committers(from_sha, to_sha)
4
+ ["kenmazaika@gmail.com", "regular_dude@yahoo.com"]
5
+ end
6
+ end
@@ -0,0 +1,38 @@
1
+ class MockPullRequest
2
+ def number
3
+ 10
4
+ end
5
+
6
+ def user
7
+ MockUser.new
8
+ end
9
+
10
+ def html_url
11
+ "http://omg.com/html_url"
12
+ end
13
+
14
+ def head
15
+ MockSha.new("HEAD_SHA")
16
+ end
17
+
18
+ def base
19
+ MockSha.new("BASE_SHA")
20
+ end
21
+
22
+ def title
23
+ "Omg"
24
+ end
25
+
26
+ class MockUser
27
+ def login
28
+ "kenmazaika"
29
+ end
30
+ end
31
+
32
+ class MockSha
33
+ attr_reader :sha
34
+ def initialize(sha)
35
+ @sha = sha
36
+ end
37
+ end
38
+ end
File without changes
@@ -0,0 +1,53 @@
1
+ require 'minitest/autorun'
2
+ require 'fakeweb'
3
+ require 'mocha'
4
+
5
+ ENV['yml'] = File.join(File.expand_path("..", __FILE__), "fixtures/config.yml")
6
+ require './lib/omg_pull_request'
7
+ require './test/mocks/pull_request'
8
+ require './test/mocks/git_client'
9
+
10
+ locale_dir = File.expand_path("../../locales", __FILE__)
11
+ I18n.load_path = [
12
+ File.join(locale_dir, "omg.yml"),
13
+ File.join(locale_dir, "en.yml")
14
+ ]
15
+
16
+ OmgPullRequest::TestLogger.class_eval do
17
+ def log(output)
18
+ # NOOP on logging
19
+ end
20
+ end
21
+
22
+ FakeWeb.allow_net_connect = false
23
+
24
+ def fakeweb_get_pull_request_commits
25
+ FakeWeb.register_uri(:get,
26
+ "https://omg:pull_request@api.github.com/repos/kenmazaika/pictures/pulls/10/commits",
27
+ :response => File.expand_path('test/fixtures/github_commits'))
28
+ end
29
+
30
+
31
+ def fakeweb_kenmazaika
32
+ FakeWeb.register_uri(:get,
33
+ "https://omg:pull_request@api.github.com/users/kenmazaika",
34
+ :response => File.expand_path('test/fixtures/kenmazaika'))
35
+ end
36
+
37
+ def fakeweb_comments
38
+ FakeWeb.register_uri(:get,
39
+ "https://omg:pull_request@api.github.com/repos/kenmazaika/pictures/issues/10/comments",
40
+ :response => File.expand_path('test/fixtures/comments'))
41
+ end
42
+
43
+ def fakeweb_create_comment
44
+ FakeWeb.register_uri(:post,
45
+ "https://omg:pull_request@api.github.com/repos/kenmazaika/pictures/issues/10/comments",
46
+ :response => File.expand_path('test/fixtures/create_comment'))
47
+ end
48
+
49
+ def fakeweb_pull_requests
50
+ FakeWeb.register_uri(:get,
51
+ "https://omg:pull_request@api.github.com/repos/kenmazaika/pictures/pulls",
52
+ :response => File.expand_path('test/fixtures/pull_requests'))
53
+ end