reviewlette 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +27 -0
- data/.rspec +1 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +114 -0
- data/Guardfile +24 -0
- data/LICENSE +21 -0
- data/README.md +95 -0
- data/Rakefile +5 -0
- data/bin/reviewlette +7 -0
- data/lib/matching.rb +0 -0
- data/lib/reviewlette.rb +202 -0
- data/lib/reviewlette/database.rb +77 -0
- data/lib/reviewlette/exceptions.rb +7 -0
- data/lib/reviewlette/github_connection.rb +45 -0
- data/lib/reviewlette/graph_gen.rb +62 -0
- data/lib/reviewlette/mail.rb +27 -0
- data/lib/reviewlette/trello_connection.rb +79 -0
- data/lib/reviewlette/vacations.rb +38 -0
- data/lib/reviewlette/version.rb +3 -0
- data/prophet.rb +4 -0
- data/reviewlette.gemspec +26 -0
- data/spec/database_spec.rb +34 -0
- data/spec/github_connection_spec.rb +96 -0
- data/spec/reviewlette_spec.rb +367 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/support/request_stubbing.rb +305 -0
- data/spec/trello_connection_spec.rb +202 -0
- data/spec/vacation_spec.rb +12 -0
- data/task +1 -0
- metadata +145 -0
@@ -0,0 +1,202 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Reviewlette::TrelloConnection do
|
4
|
+
|
5
|
+
subject { Reviewlette::TrelloConnection }
|
6
|
+
|
7
|
+
describe '.new' do
|
8
|
+
|
9
|
+
it 'populates board variable with instance of Trello::Board' do
|
10
|
+
stub_boards_call
|
11
|
+
expect(subject.new.board).to be_kind_of Trello::Board
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'sets up trello' do
|
15
|
+
allow(Trello::Board).to receive(:find).and_return nil
|
16
|
+
config = Reviewlette::TRELLO_CONFIG1
|
17
|
+
expect_any_instance_of(Trello::Configuration).to receive(:developer_public_key=).with(config['consumerkey']).and_call_original
|
18
|
+
subject.new
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'sets up trello' do
|
22
|
+
allow(Trello::Board).to receive(:find).and_return nil
|
23
|
+
config = Reviewlette::TRELLO_CONFIG1
|
24
|
+
expect_any_instance_of(Trello::Configuration).to receive(:member_token=).with(config['oauthtoken']).and_call_original
|
25
|
+
subject.new
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
describe '#find_member_by_id(id)' do
|
32
|
+
let( :trello_connection ) { subject.new }
|
33
|
+
|
34
|
+
before do
|
35
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
36
|
+
allow(subject).to receive(:find_card_by_id).and_return :id
|
37
|
+
end
|
38
|
+
|
39
|
+
it "finds the right card based on the trello id" do
|
40
|
+
board = double('board')
|
41
|
+
trello_connection.board = board
|
42
|
+
expect(board).to receive_message_chain(:cards, :find)
|
43
|
+
trello_connection.send(:find_card_by_id, 42)
|
44
|
+
#privates with send
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#find_member_by_username' do
|
49
|
+
let( :trello_connection ) { subject.new }
|
50
|
+
|
51
|
+
before do
|
52
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
53
|
+
allow(subject).to receive(:find_member_by_username).and_return :username
|
54
|
+
end
|
55
|
+
|
56
|
+
it "finds a member based on a username and returns a trello member object" do
|
57
|
+
board = double('board')
|
58
|
+
trello_connection.board = board
|
59
|
+
expect(board).to receive_message_chain(:members, :find)
|
60
|
+
trello_connection.send(:find_member_by_username, 'art')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe '#find_member_by_id' do
|
65
|
+
let( :trello_connection ) { subject.new }
|
66
|
+
|
67
|
+
before do
|
68
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
69
|
+
allow(subject).to receive(:find_member_by_id).and_return :id
|
70
|
+
end
|
71
|
+
|
72
|
+
it "finds the right member based on the trello id and returns a trello member object" do
|
73
|
+
board = double('board')
|
74
|
+
trello_connection.board = board
|
75
|
+
expect(board).to receive_message_chain(:members, :find)
|
76
|
+
trello_connection.send(:find_member_by_id, 42)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#add_reviewer_to_card' do
|
81
|
+
let ( :trello_connection ) { subject.new }
|
82
|
+
|
83
|
+
before do
|
84
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
85
|
+
end
|
86
|
+
|
87
|
+
it "adds the valid member to the trello card and comments it" do
|
88
|
+
card = double('card')
|
89
|
+
allow(card).to receive(:add_member).and_return true
|
90
|
+
expect(trello_connection.add_reviewer_to_card('asd', card)).to eq true
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '#comment_on_card' do
|
95
|
+
let ( :trello_connection ) { subject.new }
|
96
|
+
|
97
|
+
before do
|
98
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
99
|
+
end
|
100
|
+
|
101
|
+
it "comments on the assigned trello card " do
|
102
|
+
card = double('card')
|
103
|
+
allow(card).to receive(:add_comment).with('username').and_return true
|
104
|
+
expect(trello_connection.comment_on_card('username', card)).to eq true
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe '#team' do
|
109
|
+
let ( :trello_connection ) { subject.new }
|
110
|
+
|
111
|
+
before do
|
112
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
113
|
+
end
|
114
|
+
|
115
|
+
it "builds the team member list" do
|
116
|
+
expect(trello_connection.team).to be_a_kind_of Array
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe '#move_card_to_list' do
|
121
|
+
let( :trello_connection ) { subject.new }
|
122
|
+
|
123
|
+
before do
|
124
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'move cards to its certain column' do
|
128
|
+
card = double('card')
|
129
|
+
allow(card).to receive(:move_to_list).with('Done').and_return true
|
130
|
+
expect(trello_connection.move_card_to_list(card, 'Done')).to be true
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'fails to move cards to its certain column' do
|
134
|
+
card = double('card')
|
135
|
+
allow(card).to receive(:move_to_list).with('Done').and_return false
|
136
|
+
expect(trello_connection.move_card_to_list(card, 'Done')).to be false
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
describe '#find_column' do
|
141
|
+
let( :trello_connection ) { subject.new }
|
142
|
+
|
143
|
+
before do
|
144
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'detects columns' do
|
148
|
+
board = double('board')
|
149
|
+
trello_connection.board = board
|
150
|
+
expect(board).to receive_message_chain(:lists, :find)
|
151
|
+
trello_connection.send(:find_column, 'Done')
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
describe '#sample_reviewer' do
|
156
|
+
let ( :trello_connection ) { subject.new }
|
157
|
+
|
158
|
+
before do
|
159
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
160
|
+
end
|
161
|
+
it 'randomly selects a teammember' do
|
162
|
+
card = double('card')
|
163
|
+
expect(card).to receive_message_chain(:assignees, :map).and_return ['funny','names']
|
164
|
+
trello_connection.sample_reviewer(card)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
describe '#reviewer_exception_handler' do
|
169
|
+
let ( :trello_connection ) { subject.new }
|
170
|
+
|
171
|
+
before do
|
172
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
173
|
+
end
|
174
|
+
it 'checks sum of for card assignees' do
|
175
|
+
card = double('card')
|
176
|
+
expect(card).to receive_message_chain(:assignees, :map).and_return [1,2,3]
|
177
|
+
trello_connection.reviewer_exception_handler(card)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
describe '#determine_reviewer' do
|
182
|
+
let ( :trello_connection ) { subject.new }
|
183
|
+
|
184
|
+
before do
|
185
|
+
allow_any_instance_of(subject).to receive(:setup_trello).and_return true
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'fails to holds an array of the available reveiewers' do
|
189
|
+
card = double('card')
|
190
|
+
expect(trello_connection).to receive(:reviewer_exception_handler).with(card).and_return true
|
191
|
+
expect{trello_connection.determine_reviewer(card)}.to raise_error(Exception, 'Everyone on the team is assigned to the Card.')
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'holds an array of the available reveiewers' do
|
195
|
+
card = double('card')
|
196
|
+
expect(trello_connection).to receive(:reviewer_exception_handler).with(card).and_return false
|
197
|
+
expect(trello_connection).to receive(:sample_reviewer).and_return true
|
198
|
+
expect(trello_connection).to receive(:find_member_by_username).and_return 'name'
|
199
|
+
expect(trello_connection.determine_reviewer(card)).to eq 'name'
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: reviewlette
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jschmid1
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ruby-trello
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: octokit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sequel
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.13.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.13.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sqlite3
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.3.9
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.3.9
|
69
|
+
description: Easy, fair and trackable labor division in your team.
|
70
|
+
email:
|
71
|
+
- jschmid@suse.de
|
72
|
+
executables:
|
73
|
+
- reviewlette
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- .rspec
|
79
|
+
- .travis.yml
|
80
|
+
- Gemfile
|
81
|
+
- Gemfile.lock
|
82
|
+
- Guardfile
|
83
|
+
- LICENSE
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- bin/reviewlette
|
87
|
+
- config/.github.yml
|
88
|
+
- config/.members.yml
|
89
|
+
- config/.trello.yml
|
90
|
+
- lib/matching.rb
|
91
|
+
- lib/reviewlette.rb
|
92
|
+
- lib/reviewlette/database.rb
|
93
|
+
- lib/reviewlette/exceptions.rb
|
94
|
+
- lib/reviewlette/github_connection.rb
|
95
|
+
- lib/reviewlette/graph.html
|
96
|
+
- lib/reviewlette/graph_gen.rb
|
97
|
+
- lib/reviewlette/mail.rb
|
98
|
+
- lib/reviewlette/reviewlette.db
|
99
|
+
- lib/reviewlette/trello_connection.rb
|
100
|
+
- lib/reviewlette/vacations.rb
|
101
|
+
- lib/reviewlette/version.rb
|
102
|
+
- prophet.rb
|
103
|
+
- reviewlette.db
|
104
|
+
- reviewlette.gemspec
|
105
|
+
- spec/database_spec.rb
|
106
|
+
- spec/github_connection_spec.rb
|
107
|
+
- spec/reviewlette_spec.rb
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
- spec/support/request_stubbing.rb
|
110
|
+
- spec/trello_connection_spec.rb
|
111
|
+
- spec/vacation_spec.rb
|
112
|
+
- task
|
113
|
+
homepage: http://rubygems.org/gems/reviewlette
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.0.3
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Randomly assignes a reviewer to your Pullrequest and corresponding Trello
|
137
|
+
Card.
|
138
|
+
test_files:
|
139
|
+
- spec/database_spec.rb
|
140
|
+
- spec/github_connection_spec.rb
|
141
|
+
- spec/reviewlette_spec.rb
|
142
|
+
- spec/spec_helper.rb
|
143
|
+
- spec/support/request_stubbing.rb
|
144
|
+
- spec/trello_connection_spec.rb
|
145
|
+
- spec/vacation_spec.rb
|