lita-github 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,18 @@
1
1
  # -*- coding: UTF-8 -*-
2
+ #
3
+ # Copyright 2014 PagerDuty, Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
2
16
 
3
17
  require 'spec_helper'
4
18
 
@@ -378,12 +392,12 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
378
392
  end
379
393
 
380
394
  describe '.list_line' do
381
- let(:pr) { { title: 'Test', number: 42, html_url: 'nothtml' } }
395
+ let(:pr) { { title: 'Test', number: 42, html_url: 'nothtml', user: { login: 'theckman' } } }
382
396
  let(:full_name) { 'GrapeDuty/lita-test' }
383
397
 
384
398
  it 'should return a PR header' do
385
399
  l = github_pr.send(:list_line, pr, full_name)
386
- expect(l).to eql "GrapeDuty/lita-test #42: Test :: nothtml\n"
400
+ expect(l).to eql "GrapeDuty/lita-test #42: 'Test' opened by theckman :: nothtml\n"
387
401
  end
388
402
  end
389
403
 
@@ -436,7 +450,7 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
436
450
  end
437
451
 
438
452
  it 'should reply with the expeced output' do
439
- r = 'GrapeDuty/lita-test #42: Test Pull Request (Not Real) :: ' \
453
+ r = "GrapeDuty/lita-test #42: 'Test Pull Request (Not Real)' :: " \
440
454
  "https://github.com/GrapeDuty/lita-test/pulls/42\n" \
441
455
  "Opened By: theckman (Tim Heckman) | State: Open | Build: success | Mergeable: true\n" \
442
456
  'Head: 1234567 | Commits: 1 (+42/-0) :: ' \
@@ -463,7 +477,7 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
463
477
  end
464
478
 
465
479
  it 'should reply with the expeced output' do
466
- r = 'GrapeDuty/lita-test #42: Test Pull Request (Not Real) :: ' \
480
+ r = "GrapeDuty/lita-test #42: 'Test Pull Request (Not Real)' :: " \
467
481
  "https://github.com/GrapeDuty/lita-test/pulls/42\n" \
468
482
  'Opened By: theckman (Tim Heckman) | State: Merged | Build: success | ' \
469
483
  "Merged By: theckman (Tim Heckman)\n" \
@@ -589,8 +603,8 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
589
603
  context 'when there are less than 20 prs' do
590
604
  before do
591
605
  pr = [
592
- { title: 'Test2', number: 84, html_url: 'nohtmlurl' },
593
- { title: 'Test1', number: 42, html_url: 'htmlurl' }
606
+ { title: 'Test2', number: 84, html_url: 'nohtmlurl', user: { login: 'theckman' } },
607
+ { title: 'Test1', number: 42, html_url: 'htmlurl', user: { login: 'theckman' } }
594
608
  ]
595
609
  octo_obj = double('Octokit::Client', pull_requests: pr)
596
610
  allow(github_pr).to receive(:octo).and_return(octo_obj)
@@ -598,35 +612,35 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
598
612
 
599
613
  it 'should reply with the PRs' do
600
614
  send_command("gh pr list #{github_org}/#{github_repo}")
601
- expect(replies.last).to eql "GrapeDuty/lita-test #84: Test2 :: nohtmlurl\n" \
602
- "GrapeDuty/lita-test #42: Test1 :: htmlurl\n"
615
+ expect(replies.last).to eql "GrapeDuty/lita-test #84: 'Test2' opened by theckman :: nohtmlurl\n" \
616
+ "GrapeDuty/lita-test #42: 'Test1' opened by theckman :: htmlurl\n"
603
617
  end
604
618
  end
605
619
 
606
620
  context 'when there are more than 20 prs' do
607
621
  before do
608
622
  pr = [
609
- { title: 'Test21', number: 84, html_url: 'xxx' },
610
- { title: 'Test20', number: 83, html_url: 'xxx' },
611
- { title: 'Test19', number: 82, html_url: 'xxx' },
612
- { title: 'Test18', number: 80, html_url: 'xxx' },
613
- { title: 'Test17', number: 78, html_url: 'xxx' },
614
- { title: 'Test16', number: 74, html_url: 'xxx' },
615
- { title: 'Test15', number: 68, html_url: 'xxx' },
616
- { title: 'Test14', number: 66, html_url: 'xxx' },
617
- { title: 'Test13', number: 64, html_url: 'xxx' },
618
- { title: 'Test12', number: 55, html_url: 'xxx' },
619
- { title: 'Test11', number: 52, html_url: 'xxx' },
620
- { title: 'Test10', number: 51, html_url: 'xxx' },
621
- { title: 'Test9', number: 50, html_url: 'xxx' },
622
- { title: 'Test8', number: 49, html_url: 'xxx' },
623
- { title: 'Test7', number: 48, html_url: 'xxx' },
624
- { title: 'Test6', number: 47, html_url: 'xxx' },
625
- { title: 'Test5', number: 46, html_url: 'xxx' },
626
- { title: 'Test4', number: 45, html_url: 'xxx' },
627
- { title: 'Test3', number: 44, html_url: 'xxx' },
628
- { title: 'Test2', number: 43, html_url: 'xxx' },
629
- { title: 'Test1', number: 42, html_url: 'xxx' }
623
+ { title: 'Test21', number: 84, html_url: 'xxx', user: { login: 'theckman' } },
624
+ { title: 'Test20', number: 83, html_url: 'xxx', user: { login: 'theckman' } },
625
+ { title: 'Test19', number: 82, html_url: 'xxx', user: { login: 'theckman' } },
626
+ { title: 'Test18', number: 80, html_url: 'xxx', user: { login: 'theckman' } },
627
+ { title: 'Test17', number: 78, html_url: 'xxx', user: { login: 'theckman' } },
628
+ { title: 'Test16', number: 74, html_url: 'xxx', user: { login: 'theckman' } },
629
+ { title: 'Test15', number: 68, html_url: 'xxx', user: { login: 'theckman' } },
630
+ { title: 'Test14', number: 66, html_url: 'xxx', user: { login: 'theckman' } },
631
+ { title: 'Test13', number: 64, html_url: 'xxx', user: { login: 'theckman' } },
632
+ { title: 'Test12', number: 55, html_url: 'xxx', user: { login: 'theckman' } },
633
+ { title: 'Test11', number: 52, html_url: 'xxx', user: { login: 'theckman' } },
634
+ { title: 'Test10', number: 51, html_url: 'xxx', user: { login: 'theckman' } },
635
+ { title: 'Test9', number: 50, html_url: 'xxx', user: { login: 'theckman' } },
636
+ { title: 'Test8', number: 49, html_url: 'xxx', user: { login: 'theckman' } },
637
+ { title: 'Test7', number: 48, html_url: 'xxx', user: { login: 'theckman' } },
638
+ { title: 'Test6', number: 47, html_url: 'xxx', user: { login: 'theckman' } },
639
+ { title: 'Test5', number: 46, html_url: 'xxx', user: { login: 'theckman' } },
640
+ { title: 'Test4', number: 45, html_url: 'xxx', user: { login: 'theckman' } },
641
+ { title: 'Test3', number: 44, html_url: 'xxx', user: { login: 'theckman' } },
642
+ { title: 'Test2', number: 43, html_url: 'xxx', user: { login: 'theckman' } },
643
+ { title: 'Test1', number: 42, html_url: 'xxx', user: { login: 'theckman' } }
630
644
  ]
631
645
  octo_obj = double('Octokit::Client', pull_requests: pr)
632
646
  allow(github_pr).to receive(:octo).and_return(octo_obj)
@@ -636,27 +650,27 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
636
650
  send_command("gh pr list #{github_org}/#{github_repo}")
637
651
  expect(replies.last)
638
652
  .to eql "You have more than 20 open pull requests :(! Here are the ten newest oldest:
639
- GrapeDuty/lita-test #84: Test21 :: xxx
640
- GrapeDuty/lita-test #83: Test20 :: xxx
641
- GrapeDuty/lita-test #82: Test19 :: xxx
642
- GrapeDuty/lita-test #80: Test18 :: xxx
643
- GrapeDuty/lita-test #78: Test17 :: xxx
644
- GrapeDuty/lita-test #74: Test16 :: xxx
645
- GrapeDuty/lita-test #68: Test15 :: xxx
646
- GrapeDuty/lita-test #66: Test14 :: xxx
647
- GrapeDuty/lita-test #64: Test13 :: xxx
648
- GrapeDuty/lita-test #55: Test12 :: xxx
653
+ GrapeDuty/lita-test #84: 'Test21' opened by theckman :: xxx
654
+ GrapeDuty/lita-test #83: 'Test20' opened by theckman :: xxx
655
+ GrapeDuty/lita-test #82: 'Test19' opened by theckman :: xxx
656
+ GrapeDuty/lita-test #80: 'Test18' opened by theckman :: xxx
657
+ GrapeDuty/lita-test #78: 'Test17' opened by theckman :: xxx
658
+ GrapeDuty/lita-test #74: 'Test16' opened by theckman :: xxx
659
+ GrapeDuty/lita-test #68: 'Test15' opened by theckman :: xxx
660
+ GrapeDuty/lita-test #66: 'Test14' opened by theckman :: xxx
661
+ GrapeDuty/lita-test #64: 'Test13' opened by theckman :: xxx
662
+ GrapeDuty/lita-test #55: 'Test12' opened by theckman :: xxx
649
663
  ----
650
- GrapeDuty/lita-test #51: Test10 :: xxx
651
- GrapeDuty/lita-test #50: Test9 :: xxx
652
- GrapeDuty/lita-test #49: Test8 :: xxx
653
- GrapeDuty/lita-test #48: Test7 :: xxx
654
- GrapeDuty/lita-test #47: Test6 :: xxx
655
- GrapeDuty/lita-test #46: Test5 :: xxx
656
- GrapeDuty/lita-test #45: Test4 :: xxx
657
- GrapeDuty/lita-test #44: Test3 :: xxx
658
- GrapeDuty/lita-test #43: Test2 :: xxx
659
- GrapeDuty/lita-test #42: Test1 :: xxx
664
+ GrapeDuty/lita-test #51: 'Test10' opened by theckman :: xxx
665
+ GrapeDuty/lita-test #50: 'Test9' opened by theckman :: xxx
666
+ GrapeDuty/lita-test #49: 'Test8' opened by theckman :: xxx
667
+ GrapeDuty/lita-test #48: 'Test7' opened by theckman :: xxx
668
+ GrapeDuty/lita-test #47: 'Test6' opened by theckman :: xxx
669
+ GrapeDuty/lita-test #46: 'Test5' opened by theckman :: xxx
670
+ GrapeDuty/lita-test #45: 'Test4' opened by theckman :: xxx
671
+ GrapeDuty/lita-test #44: 'Test3' opened by theckman :: xxx
672
+ GrapeDuty/lita-test #43: 'Test2' opened by theckman :: xxx
673
+ GrapeDuty/lita-test #42: 'Test1' opened by theckman :: xxx
660
674
  "
661
675
  end
662
676
  end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  #
3
- # Copyright 2014 GrapeDuty, Inc.
3
+ # Copyright 2014 PagerDuty, Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -42,6 +42,10 @@ describe Lita::Handlers::Github, lita_handler: true do
42
42
  expect(Lita.config.handlers.github.repo_private_default).to be_truthy
43
43
  end
44
44
 
45
+ it 'should allow only teams with "pull" permissions to be created by default' do
46
+ expect(Lita.config.handlers.github.org_team_add_allowed_perms).to eql %w(pull)
47
+ end
48
+
45
49
  it 'should enable Lita::Handlers::GithubRepo.repo_create by default' do
46
50
  expect(Lita.config.handlers.github.repo_create_enabled).to be_truthy
47
51
  end
@@ -78,8 +82,16 @@ describe Lita::Handlers::Github, lita_handler: true do
78
82
  expect(Lita.config.handlers.github.org_team_rm_enabled).to be_falsey
79
83
  end
80
84
 
81
- it 'should allow only teams with "pull" permissions to be created by default' do
82
- expect(Lita.config.handlers.github.org_team_add_allowed_perms).to eql %w(pull)
85
+ it 'should disable Lita::Handlers::GithubOrg.org_user_add by default' do
86
+ expect(Lita.config.handlers.github.org_user_add_enabled).to be_falsey
87
+ end
88
+
89
+ it 'should disable Lita::Handlers::GithubOrg.org_user_rm by default' do
90
+ expect(Lita.config.handlers.github.org_user_rm_enabled).to be_falsey
91
+ end
92
+
93
+ it 'should disable Lita::Handlers::GithubOrg.org_eject_user by default' do
94
+ expect(Lita.config.handlers.github.org_eject_user_enabled).to be_falsey
83
95
  end
84
96
  end
85
97
 
@@ -135,7 +147,7 @@ Company: PagerDuty, Inc.
135
147
  Orgs: PagerDuty, GrapeDuty
136
148
  ID: 787332, Email: tim@pagerduty.com
137
149
  GitHub Admin: false, Repos: 42, Gists: 1
138
- Following: 20, Followers: 10, Created: 2011-05-14 04:16:33 UTC'
150
+ Following: 20, Followers: 10, Joined: 2011-05-14 04:16:33 UTC'
139
151
  end
140
152
  end
141
153
 
@@ -150,7 +162,7 @@ Company: PagerDuty, Inc.
150
162
  Orgs: PagerDuty, GrapeDuty
151
163
  ID: 787332, Email: tim@pagerduty.com
152
164
  GitHub Admin: false, Repos: 42, Gists: 1
153
- Following: 20, Followers: 10, Created: 2011-05-14 04:16:33 UTC'
165
+ Following: 20, Followers: 10, Joined: 2011-05-14 04:16:33 UTC'
154
166
  end
155
167
  end
156
168
 
@@ -164,7 +176,7 @@ Company: PagerDuty, Inc.
164
176
  Orgs: PagerDuty, GrapeDuty
165
177
  ID: 787332, Email: tim@pagerduty.com
166
178
  GitHub Admin: false, Repos: 42, Gists: 1
167
- Following: 20, Followers: 10, Created: 2011-05-14 04:16:33 UTC'
179
+ Following: 20, Followers: 10, Joined: 2011-05-14 04:16:33 UTC'
168
180
  end
169
181
  end
170
182
 
@@ -178,7 +190,7 @@ Located: San Francisco, CA
178
190
  Orgs: PagerDuty, GrapeDuty
179
191
  ID: 787332, Email: tim@pagerduty.com
180
192
  GitHub Admin: false, Repos: 42, Gists: 1
181
- Following: 20, Followers: 10, Created: 2011-05-14 04:16:33 UTC'
193
+ Following: 20, Followers: 10, Joined: 2011-05-14 04:16:33 UTC'
182
194
  end
183
195
  end
184
196
 
@@ -192,7 +204,7 @@ Located: San Francisco, CA
192
204
  Company: PagerDuty, Inc.
193
205
  ID: 787332, Email: tim@pagerduty.com
194
206
  GitHub Admin: false, Repos: 42, Gists: 1
195
- Following: 20, Followers: 10, Created: 2011-05-14 04:16:33 UTC'
207
+ Following: 20, Followers: 10, Joined: 2011-05-14 04:16:33 UTC'
196
208
  end
197
209
  end
198
210
 
@@ -207,7 +219,7 @@ Company: PagerDuty, Inc.
207
219
  Orgs: PagerDuty, GrapeDuty
208
220
  ID: 787332
209
221
  GitHub Admin: false, Repos: 42, Gists: 1
210
- Following: 20, Followers: 10, Created: 2011-05-14 04:16:33 UTC'
222
+ Following: 20, Followers: 10, Joined: 2011-05-14 04:16:33 UTC'
211
223
  end
212
224
  end
213
225
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-github
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
  - Tim Heckman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-16 00:00:00.000000000 Z
11
+ date: 2014-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -215,6 +215,7 @@ files:
215
215
  - lib/lita-github/repo.rb
216
216
  - lib/lita-github/version.rb
217
217
  - lib/lita/handlers/github.rb
218
+ - lib/lita/handlers/github_issues.rb
218
219
  - lib/lita/handlers/github_org.rb
219
220
  - lib/lita/handlers/github_pr.rb
220
221
  - lib/lita/handlers/github_repo.rb
@@ -229,6 +230,7 @@ files:
229
230
  - spec/unit/lita-github/r_spec.rb
230
231
  - spec/unit/lita-github/repo_spec.rb
231
232
  - spec/unit/lita-github/version_spec.rb
233
+ - spec/unit/lita/handlers/github_issues_spec.rb
232
234
  - spec/unit/lita/handlers/github_org_spec.rb
233
235
  - spec/unit/lita/handlers/github_pr_spec.rb
234
236
  - spec/unit/lita/handlers/github_repo_spec.rb
@@ -269,6 +271,7 @@ test_files:
269
271
  - spec/unit/lita-github/r_spec.rb
270
272
  - spec/unit/lita-github/repo_spec.rb
271
273
  - spec/unit/lita-github/version_spec.rb
274
+ - spec/unit/lita/handlers/github_issues_spec.rb
272
275
  - spec/unit/lita/handlers/github_org_spec.rb
273
276
  - spec/unit/lita/handlers/github_pr_spec.rb
274
277
  - spec/unit/lita/handlers/github_repo_spec.rb