trollolo 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/Gemfile +1 -1
  4. data/README.md +97 -0
  5. data/lib/card.rb +0 -14
  6. data/lib/cli.rb +66 -27
  7. data/lib/empty_column.rb +5 -0
  8. data/lib/scrum/backlog_mover.rb +47 -0
  9. data/lib/scrum/card_type_detection.rb +23 -0
  10. data/lib/scrum/creator.rb +30 -0
  11. data/lib/scrum/prioritizer.rb +24 -0
  12. data/lib/scrum/priority_name.rb +15 -0
  13. data/lib/scrum/scrum_boards.rb +11 -0
  14. data/lib/scrum/sprint_board.rb +82 -0
  15. data/lib/scrum/sprint_cleaner.rb +41 -0
  16. data/lib/scrum/sprint_planning_board.rb +26 -0
  17. data/lib/scrum.rb +13 -0
  18. data/lib/scrum_board.rb +17 -7
  19. data/lib/settings.rb +36 -12
  20. data/lib/trello_service.rb +22 -0
  21. data/lib/trello_wrapper.rb +9 -23
  22. data/lib/trollolo.rb +3 -2
  23. data/lib/version.rb +1 -1
  24. data/man/trollolo.1.md +22 -1
  25. data/spec/data/board.json +3 -4
  26. data/spec/data/full-board-with-accepted.json +1817 -0
  27. data/spec/data/full-board.json +3 -27
  28. data/spec/data/trollolorc +13 -0
  29. data/spec/data/trollolorc_with_board_aliases +9 -0
  30. data/spec/data/vcr/creator_custom_config.yml +824 -0
  31. data/spec/data/vcr/creator_default_config.yml +824 -0
  32. data/spec/data/vcr/move_backlog.yml +2375 -0
  33. data/spec/data/vcr/move_backlog_missing_backlog.yml +155 -0
  34. data/spec/data/vcr/move_backlog_missing_waterbed.yml +364 -0
  35. data/spec/data/vcr/prioritize_backlog_list.yml +2335 -0
  36. data/spec/data/vcr/prioritize_no_backlog_list.yml +190 -0
  37. data/spec/data/vcr/sprint_board.yml +624 -0
  38. data/spec/data/vcr/sprint_board_no_waterline.yml +556 -0
  39. data/spec/data/vcr/sprint_cleanup.yml +1239 -7500
  40. data/spec/data/vcr/sprint_planning_board.yml +239 -0
  41. data/spec/integration/create_burndown_spec.rb +1 -1
  42. data/spec/unit/card_spec.rb +0 -41
  43. data/spec/unit/cli_spec.rb +74 -1
  44. data/spec/unit/empty_column_spec.rb +9 -0
  45. data/spec/unit/scrum/backlog_mover_spec.rb +26 -0
  46. data/spec/unit/scrum/card_type_detection_spec.rb +35 -0
  47. data/spec/unit/scrum/creator_spec.rb +23 -0
  48. data/spec/unit/scrum/prioritizer_spec.rb +45 -0
  49. data/spec/unit/scrum/priority_name_spec.rb +35 -0
  50. data/spec/unit/scrum/sprint_board_spec.rb +22 -0
  51. data/spec/unit/scrum/sprint_cleaner_spec.rb +26 -0
  52. data/spec/unit/scrum/sprint_planning_board_spec.rb +14 -0
  53. data/spec/unit/scrum_board_spec.rb +90 -0
  54. data/spec/unit/settings_spec.rb +42 -6
  55. data/spec/unit/spec_helper.rb +3 -2
  56. data/spec/unit/support/update_webmock_data +3 -1
  57. data/spec/unit/support/vcr.rb +8 -8
  58. data/spec/unit/support/webmocks.rb +9 -0
  59. data/spec/unit/trello_wrapper_spec.rb +20 -0
  60. data/trollolo.gemspec +2 -1
  61. metadata +52 -9
  62. data/lib/prioritizer.rb +0 -34
  63. data/lib/sprint_cleanup.rb +0 -54
  64. data/spec/unit/prioritizer_spec.rb +0 -47
  65. data/spec/unit/sprint_cleanup_spec.rb +0 -18
@@ -0,0 +1,239 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.trello.com/1/boards/neUHHzDo?key=mykey&token=mytoken
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, must-revalidate, no-cache, no-store
23
+ X-Content-Type-Options:
24
+ - nosniff
25
+ Strict-Transport-Security:
26
+ - max-age=15768000
27
+ X-Xss-Protection:
28
+ - 1; mode=block
29
+ X-Frame-Options:
30
+ - DENY
31
+ X-Trello-Version:
32
+ - 1.724.0
33
+ X-Trello-Environment:
34
+ - Production
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Allow-Methods:
38
+ - GET, PUT, POST, DELETE
39
+ Access-Control-Allow-Headers:
40
+ - Authorization, Accept, Content-Type
41
+ X-Server-Time:
42
+ - '1470828145615'
43
+ Expires:
44
+ - Thu, 01 Jan 1970 00:00:00
45
+ X-Trello-Index-Last-Update:
46
+ - '409'
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ Content-Length:
50
+ - '805'
51
+ Etag:
52
+ - W/"325-d20b3c91"
53
+ Vary:
54
+ - Accept-Encoding
55
+ Date:
56
+ - Wed, 10 Aug 2016 11:22:25 GMT
57
+ Connection:
58
+ - keep-alive
59
+ Set-Cookie:
60
+ - dsc=27bc6d64a628b9116dd4165787a231f57211b144eb8bdeca9f66dcc7a526155f; Path=/;
61
+ Expires=Sat, 13 Aug 2016 11:22:25 GMT; Secure
62
+ body:
63
+ encoding: UTF-8
64
+ string: '{"id":"577b6e6e00d1313a68d3a60a","name":"Test Planning Board","desc":"","descData":null,"closed":false,"idOrganization":null,"pinned":false,"url":"https://trello.com/b/neUHHzDo/test-planning-board","shortUrl":"https://trello.com/b/neUHHzDo","prefs":{"permissionLevel":"private","voting":"disabled","comments":"members","invitations":"members","selfJoin":false,"cardCovers":true,"cardAging":"regular","calendarFeedEnabled":false,"background":"sky","backgroundImage":null,"backgroundImageScaled":null,"backgroundTile":false,"backgroundBrightness":"dark","backgroundColor":"#00AECC","canBePublic":true,"canBeOrg":true,"canBePrivate":true,"canInvite":true},"labelNames":{"green":"","yellow":"Under
65
+ waterline","orange":"","red":"","purple":"Dependent","blue":"","sky":"","lime":"","pink":"","black":"Pairing"}}'
66
+ http_version:
67
+ recorded_at: Wed, 10 Aug 2016 11:22:35 GMT
68
+ - request:
69
+ method: get
70
+ uri: https://api.trello.com/1/boards/577b6e6e00d1313a68d3a60a/lists?filter=open&key=mykey&token=mytoken
71
+ body:
72
+ encoding: US-ASCII
73
+ string: ''
74
+ headers:
75
+ Accept:
76
+ - "*/*; q=0.5, application/xml"
77
+ Accept-Encoding:
78
+ - gzip, deflate
79
+ User-Agent:
80
+ - Ruby
81
+ response:
82
+ status:
83
+ code: 200
84
+ message: OK
85
+ headers:
86
+ Cache-Control:
87
+ - max-age=0, must-revalidate, no-cache, no-store
88
+ X-Content-Type-Options:
89
+ - nosniff
90
+ Strict-Transport-Security:
91
+ - max-age=15768000
92
+ X-Xss-Protection:
93
+ - 1; mode=block
94
+ X-Frame-Options:
95
+ - DENY
96
+ X-Trello-Version:
97
+ - 1.724.0
98
+ X-Trello-Environment:
99
+ - Production
100
+ Access-Control-Allow-Origin:
101
+ - "*"
102
+ Access-Control-Allow-Methods:
103
+ - GET, PUT, POST, DELETE
104
+ Access-Control-Allow-Headers:
105
+ - Authorization, Accept, Content-Type
106
+ X-Server-Time:
107
+ - '1470828145860'
108
+ Expires:
109
+ - Thu, 01 Jan 1970 00:00:00
110
+ Content-Type:
111
+ - application/json; charset=utf-8
112
+ Content-Length:
113
+ - '674'
114
+ Etag:
115
+ - W/"2a2-2c535b0"
116
+ Vary:
117
+ - Accept-Encoding
118
+ Date:
119
+ - Wed, 10 Aug 2016 11:22:25 GMT
120
+ Connection:
121
+ - keep-alive
122
+ Set-Cookie:
123
+ - dsc=f1b143d31ce5951ce65cdd35c51a97c087a55d2d9b8474509b2fafd5a22c81e8; Path=/;
124
+ Expires=Sat, 13 Aug 2016 11:22:25 GMT; Secure
125
+ body:
126
+ encoding: UTF-8
127
+ string: '[{"id":"57a78bc5980cdceb09195dc9","name":"Backlog Backup","closed":false,"idBoard":"577b6e6e00d1313a68d3a60a","pos":36863,"subscribed":false},{"id":"57ab0d62e68c078f91d15af0","name":"Backlog","closed":false,"idBoard":"577b6e6e00d1313a68d3a60a","pos":87551,"subscribed":false},{"id":"577b6e75ce0f88ec9af823c0","name":"Done","closed":false,"idBoard":"577b6e6e00d1313a68d3a60a","pos":131071,"subscribed":false},{"id":"577b6e78ef9a4b2cb2f08ed0","name":"Doing","closed":false,"idBoard":"577b6e6e00d1313a68d3a60a","pos":196607,"subscribed":false},{"id":"578e03cf104153b060cc27bd","name":"Ready","closed":false,"idBoard":"577b6e6e00d1313a68d3a60a","pos":344063,"subscribed":false}]'
128
+ http_version:
129
+ recorded_at: Wed, 10 Aug 2016 11:22:35 GMT
130
+ - request:
131
+ method: get
132
+ uri: https://api.trello.com/1/lists/57ab0d62e68c078f91d15af0/cards?filter=open&key=mykey&token=mytoken
133
+ body:
134
+ encoding: US-ASCII
135
+ string: ''
136
+ headers:
137
+ Accept:
138
+ - "*/*; q=0.5, application/xml"
139
+ Accept-Encoding:
140
+ - gzip, deflate
141
+ User-Agent:
142
+ - Ruby
143
+ response:
144
+ status:
145
+ code: 200
146
+ message: OK
147
+ headers:
148
+ Cache-Control:
149
+ - max-age=0, must-revalidate, no-cache, no-store
150
+ X-Content-Type-Options:
151
+ - nosniff
152
+ Strict-Transport-Security:
153
+ - max-age=15768000
154
+ X-Xss-Protection:
155
+ - 1; mode=block
156
+ X-Frame-Options:
157
+ - DENY
158
+ X-Trello-Version:
159
+ - 1.724.0
160
+ X-Trello-Environment:
161
+ - Production
162
+ Access-Control-Allow-Origin:
163
+ - "*"
164
+ Access-Control-Allow-Methods:
165
+ - GET, PUT, POST, DELETE
166
+ Access-Control-Allow-Headers:
167
+ - Authorization, Accept, Content-Type
168
+ X-Server-Time:
169
+ - '1470828146187'
170
+ Expires:
171
+ - Thu, 01 Jan 1970 00:00:00
172
+ Content-Type:
173
+ - application/json; charset=utf-8
174
+ Etag:
175
+ - W/"2iPQqSr5dA65OFjJOhf58Q=="
176
+ Vary:
177
+ - Accept-Encoding
178
+ Content-Encoding:
179
+ - gzip
180
+ Content-Length:
181
+ - '1992'
182
+ Date:
183
+ - Wed, 10 Aug 2016 11:22:26 GMT
184
+ Connection:
185
+ - keep-alive
186
+ Set-Cookie:
187
+ - dsc=8db60331081aa8b6a38a39a983f68415f168179201f7c3a9a3c565ca669ab690; Path=/;
188
+ Expires=Sat, 13 Aug 2016 11:22:26 GMT; Secure
189
+ body:
190
+ encoding: ASCII-8BIT
191
+ string: !binary |-
192
+ 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
236
+ nubbvwgJOdA/QQAA
237
+ http_version:
238
+ recorded_at: Wed, 10 Aug 2016 11:22:35 GMT
239
+ recorded_with: VCR 3.0.3
@@ -9,7 +9,7 @@ def run_helper(working_dir, sprint_number, extra_args = [])
9
9
  args += ["-v", "#{helper_dir}:/trollolo/helper"]
10
10
  args += ["-v", "#{working_dir}:/trollolo/data"]
11
11
  args += ["-w", "/trollolo/data"]
12
- args += ["matplotlib"]
12
+ args += ["trollolo-matplotlib"]
13
13
  args += ["/trollolo/helper/create_burndown.py", sprint_number]
14
14
  args += extra_args
15
15
  run_command(cmd: "docker", args: args)
@@ -23,50 +23,10 @@ describe Card do
23
23
  expect(@card.story_points).to eq(0.5)
24
24
  end
25
25
 
26
- it "extracts priority number from card name" do
27
- allow(@card).to receive(:name).and_return "(0.5) P1: Refactor cards"
28
- expect(@card.priority).to eq(1)
29
- end
30
-
31
26
  it "extracts story points when value is not at beginning of card name" do
32
27
  allow(@card).to receive(:name).and_return "P01: (3) Refactor cards"
33
28
  expect(@card.story_points).to eq(3)
34
29
  end
35
-
36
- it "extracts priority number from card name if it is at the beginning " do
37
- allow(@card).to receive(:name).and_return "P01: (3) Refactor cards"
38
- expect(@card.priority).to eq(1)
39
- end
40
- end
41
-
42
- describe "updates priority" do
43
- before(:each) do
44
- @card = Card.new({"cards" => [{ "id" => "mycard" }]}, "mycard")
45
- end
46
-
47
- it "updates existing priority in title" do
48
- @card.name = "P01: (3) Refactor cards"
49
- @card.priority = 3
50
- expect(@card.name).to eq("P3: (3) Refactor cards")
51
- end
52
-
53
- it "adds new priority text to title" do
54
- @card.name = "(3) Refactor cards"
55
- @card.priority = 4
56
- expect(@card.name).to eq("P4: (3) Refactor cards")
57
- end
58
-
59
- it "updates priority after story points" do
60
- @card.name = "(0.5) P1: Refactor cards"
61
- @card.priority = 4
62
- expect(@card.name).to eq("(0.5) P4: Refactor cards")
63
- end
64
-
65
- it "adds priority after story points" do
66
- @card.name = "(0.5) P1: Refactor cards"
67
- @card.priority = 5
68
- expect(@card.name).to eq("(0.5) P5: Refactor cards")
69
- end
70
30
  end
71
31
 
72
32
  describe "#parse_yaml_from_description" do
@@ -162,7 +122,6 @@ EOT
162
122
  "due": null
163
123
  },
164
124
  "due": null,
165
- "email": "trello@example.com",
166
125
  "idChecklists": [
167
126
 
168
127
  ],
@@ -6,7 +6,8 @@ describe Cli do
6
6
  use_given_filesystem
7
7
 
8
8
  before(:each) do
9
- Cli.settings = dummy_settings
9
+ Cli.settings = Settings.new(
10
+ File.expand_path('../../data/trollolorc_with_board_aliases', __FILE__))
10
11
  @cli = Cli.new
11
12
  end
12
13
 
@@ -26,6 +27,12 @@ describe Cli do
26
27
  @cli.backup
27
28
  end
28
29
 
30
+ it "backups board using an alias" do
31
+ expect_any_instance_of(Backup).to receive(:backup)
32
+ @cli.options = {"board-id" => "MyTrelloBoard"}
33
+ @cli.backup
34
+ end
35
+
29
36
  it "gets lists" do
30
37
  full_board_mock
31
38
  @cli.options = {"board-id" => "53186e8391ef8671265eba9d"}
@@ -40,6 +47,13 @@ EOT
40
47
  expect {
41
48
  @cli.get_lists
42
49
  }.to output(expected_output).to_stdout
50
+
51
+
52
+ # Using an alias
53
+ @cli.options = {"board-id" => "MyTrelloBoard"}
54
+ expect {
55
+ @cli.get_lists
56
+ }.to output(expected_output).to_stdout
43
57
  end
44
58
 
45
59
  it "gets cards" do
@@ -73,6 +87,12 @@ EOT
73
87
  expect {
74
88
  @cli.get_cards
75
89
  }.to output(expected_output).to_stdout
90
+
91
+ # Using an alias
92
+ @cli.options = {"board-id" => "MyTrelloBoard"}
93
+ expect {
94
+ @cli.get_cards
95
+ }.to output(expected_output).to_stdout
76
96
  end
77
97
 
78
98
  it "gets checklists" do
@@ -95,6 +115,12 @@ EOT
95
115
  expect {
96
116
  @cli.get_checklists
97
117
  }.to output(expected_output).to_stdout
118
+
119
+ # Using an alias
120
+ @cli.options = {"board-id" => "MyTrelloBoard"}
121
+ expect {
122
+ @cli.get_checklists
123
+ }.to output(expected_output).to_stdout
98
124
  end
99
125
 
100
126
  it "gets description" do
@@ -137,4 +163,51 @@ EOT
137
163
  @cli.set_description
138
164
  expect(WebMock).to have_requested(:put, "https://api.trello.com/1/cards/54ae8485221b1cc5b173e713/desc?key=mykey&token=mytoken&value=My%20description")
139
165
  end
166
+
167
+ it "sets priorities for default planning list", vcr: "prioritize_backlog_list", vcr_record: false do
168
+ @cli.options = {"board-id" => "neUHHzDo"}
169
+
170
+ expected_output = <<-EOT
171
+ set priority to 1 for "P1: (2) Document how to run cf-openstack-validator on SUSE"
172
+ set priority to 2 for "P2: Etymologie von Foo"
173
+ set priority to 3 for "P3: (3) Set up Concourse pipeline for stemcell building"
174
+ set priority to 4 for "P4: (6) Build #stemcell in containers &sort=123"
175
+ set priority to 5 for "P5: (2) Document how to run cf-openstack-validator on SUSE"
176
+ set priority to 6 for "P6: (3) Set up Concourse pipeline for os image building"
177
+ set priority to 7 for "P7: (3) Set up Concourse pipeline for stemcell building"
178
+ set priority to 8 for "P8: (6) Build stemcell in containers"
179
+ set priority to 9 for "P9: (3) Set up Concourse pipeline for BATs"
180
+ set priority to 10 for "P10: seabed"
181
+ set priority to 11 for "P11: (3) Set up Concourse pipeline for BATs"
182
+ set priority to 12 for "P12: Bike Shedding Feature"
183
+ set priority to 13 for "P13: (3) Set up Concourse pipeline for os image building"
184
+ EOT
185
+ expect {
186
+ @cli.set_priorities
187
+ }.to output(expected_output).to_stdout
188
+ end
189
+
190
+ it "sets priorities for specified planning list", vcr: "prioritize_backlog_list", vcr_record: false do
191
+ @cli.options = {"board-id" => "neUHHzDo", "backlog-list-name" => "Nonexisting List"}
192
+
193
+ expect {
194
+ @cli.set_priorities
195
+ }.to raise_error /'Nonexisting List' not found/
196
+ end
197
+
198
+ context "#board_id" do
199
+ before do
200
+ Cli.settings = Settings.new(
201
+ File.expand_path('../../data/trollolorc_with_board_aliases', __FILE__))
202
+ @cli = Cli.new
203
+ end
204
+
205
+ it "returns the id when no alias exists" do
206
+ expect(@cli.send(:board_id, "1234")).to eq("1234")
207
+ end
208
+
209
+ it "return the id when an alias exists" do
210
+ expect(@cli.send(:board_id, "MyTrelloBoard")).to eq("53186e8391ef8671265eba9d")
211
+ end
212
+ end
140
213
  end
@@ -0,0 +1,9 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe EmptyColumn do
4
+ [:committed_cards, :extra_cards, :unplanned_cards, :cards, :fast_lane_cards].each do |cards_method|
5
+ it "##{cards_method}" do
6
+ expect(subject.send(cards_method)).to eq([])
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,26 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe Scrum::BacklogMover do
4
+ subject { described_class.new(dummy_settings) }
5
+
6
+ it "creates new move backlog" do
7
+ expect(subject).to be
8
+ end
9
+
10
+ it "fails without moving if backlog list is missing waterline or seabed", vcr: "move_backlog_missing_waterbed", vcr_record: false do
11
+ expect {
12
+ subject.move("neUHHzDo", "NzGCbEeN")
13
+ }.to raise_error("backlog list on planning board is missing waterline or seabed card")
14
+ end
15
+
16
+ it "fails without moving if sprint backlog is missing from sprint board", vcr: "move_backlog_missing_backlog", vcr_record: false do
17
+ expect {
18
+ subject.move("neUHHzDo", "NzGCbEeN")
19
+ }.to raise_error("sprint board is missing Sprint Backlog list")
20
+ end
21
+
22
+ it "moves cards to sprint board", vcr: "move_backlog", vcr_record: false do
23
+ expect(STDOUT).to receive(:puts).exactly(11).times
24
+ subject.move("neUHHzDo", "NzGCbEeN")
25
+ end
26
+ end
@@ -0,0 +1,35 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe Scrum::CardTypeDetection do
4
+ let(:dummy_class) { Class.new { include Scrum::CardTypeDetection } }
5
+ subject { dummy_class.new }
6
+ let(:waterline_card) { instance_double("Card", name: 'waterline') }
7
+ let(:upcase_waterline_card) { instance_double("Card", name: 'Waterline') }
8
+ let(:fancy_waterline_card) { instance_double("Card", name: '~~~ WaTeR lInE ~~~') }
9
+ let(:seabed_card) { instance_double("Card", name: 'seabed') }
10
+ let(:fancy_seabed_card) { instance_double("Card", name: '!-! Sea Bed !-!') }
11
+
12
+ it "recognizes waterline string" do
13
+ expect(subject.waterline?(waterline_card)).to be_truthy
14
+ end
15
+
16
+ it "refuses non waterline name" do
17
+ expect(subject.waterline?(seabed_card)).to be_falsy
18
+ end
19
+
20
+ it "recognizes upcase spellings of waterline" do
21
+ expect(subject.waterline?(upcase_waterline_card)).to be_truthy
22
+ end
23
+
24
+ it "recognizes fancy spellings of waterline" do
25
+ expect(subject.waterline?(fancy_waterline_card)).to be_truthy
26
+ end
27
+
28
+ it "recognizes fancy spellings of seabed" do
29
+ expect(subject.seabed?(fancy_seabed_card)).to be_truthy
30
+ end
31
+
32
+ it "refuses non seabed name" do
33
+ expect(subject.seabed?(waterline_card)).to be_falsy
34
+ end
35
+ end
@@ -0,0 +1,23 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe Scrum::Creator do
4
+ subject { described_class.new(dummy_settings) }
5
+ let(:custom_subject) {
6
+ custom_settings = dummy_settings
7
+ custom_settings.scrum.board_names["planning"] = "Planungs Brett"
8
+ described_class.new(custom_settings)
9
+ }
10
+
11
+ it "creates new creator" do
12
+ expect(subject).to be
13
+ end
14
+
15
+ context "default" do
16
+ it "creates boards from default config", vcr: "creator_default_config", vcr_record: false do
17
+ expect { subject.create }.not_to raise_error
18
+ end
19
+ it "creates boards according to existing config", vcr: "creator_custom_config", vcr_record: false do
20
+ expect { custom_subject.create }.not_to raise_error
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,45 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe Scrum::Prioritizer do
4
+ subject { described_class.new(dummy_settings) }
5
+
6
+ it "creates new prioritizer" do
7
+ expect(subject).to be
8
+ end
9
+
10
+ context "default" do
11
+ it "raises an exception if board is not found", vcr: "prioritize_no_backlog_list", vcr_record: false do
12
+ expect { subject.prioritize("xxxxx123") }.to raise_error(Trello::Error)
13
+ end
14
+
15
+ it "raises an exception if list is not on board", vcr: "prioritize_no_backlog_list", vcr_record: false do
16
+ expect { subject.prioritize("neUHHzDo") }.to raise_error("list named 'Backlog' not found on board")
17
+ end
18
+
19
+ it "adds priority text to card titles", vcr: "prioritize_backlog_list", vcr_record: false do
20
+ expect(STDOUT).to receive(:puts).exactly(13).times
21
+ expect { subject.prioritize("neUHHzDo") }.not_to raise_error
22
+ end
23
+ end
24
+
25
+ context "specifying backlog list as argument" do
26
+ before do
27
+ subject.settings.scrum.list_names["planning_backlog"] = "Nonexisting List"
28
+ end
29
+
30
+ it "finds backlog list", vcr: "prioritize_backlog_list", vcr_record: false do
31
+ expect(STDOUT).to receive(:puts).exactly(13).times
32
+ expect {
33
+ subject.prioritize("neUHHzDo", "Backlog")
34
+ }.not_to raise_error
35
+ end
36
+
37
+ it "throws error when default list does not exist", vcr: "prioritize_backlog_list", vcr_record: false do
38
+ expect { subject.prioritize("neUHHzDo") }.to raise_error("list named 'Nonexisting List' not found on board")
39
+ end
40
+
41
+ it "throws error when specified list does not exist", vcr: "prioritize_backlog_list", vcr_record: false do
42
+ expect { subject.prioritize("neUHHzDo", "My Backlog") }.to raise_error("list named 'My Backlog' not found on board")
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,35 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe Scrum::PriorityName do
4
+ let(:priority_name) { Scrum::PriorityName }
5
+
6
+ describe "parses name" do
7
+ it "extracts priority number from card name" do
8
+ expect(priority_name.priority("(0.5) P1: Refactor cards")).to eq(1)
9
+ end
10
+
11
+ it "extracts priority number from card name if it is at the beginning " do
12
+ expect(priority_name.priority("P01: (3) Refactor cards")).to eq(1)
13
+ end
14
+ end
15
+
16
+ describe "updates priority" do
17
+ it "updates existing priority in title" do
18
+ expect(
19
+ priority_name.build("P01: (3) Refactor cards", 3)
20
+ ).to eq("P3: (3) Refactor cards")
21
+ end
22
+
23
+ it "adds new priority text to title" do
24
+ expect(
25
+ priority_name.build("(3) Refactor cards", 4)
26
+ ).to eq("P4: (3) Refactor cards")
27
+ end
28
+
29
+ it "updates priority after story points" do
30
+ expect(
31
+ priority_name.build("(0.5) P1: Refactor cards", 4)
32
+ ).to eq("(0.5) P4: Refactor cards")
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,22 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe Scrum::SprintBoard do
4
+ subject!(:sprint_board) { described_class.new(dummy_settings.scrum) }
5
+ let!(:planning_board) { Scrum::SprintPlanningBoard.new(dummy_settings.scrum) }
6
+
7
+ before(:each) do
8
+ TrelloService.new(dummy_settings)
9
+ end
10
+
11
+ it "places existing waterline card at bottom and removes from planning board", vcr: "sprint_board", vcr_record: false do
12
+ sprint_board.setup('NzGCbEeN')
13
+ planning_board.setup('neUHHzDo')
14
+ sprint_board.place_waterline(planning_board.waterline_card)
15
+ end
16
+
17
+ it "moves waterline card from planning to bottom", vcr: "sprint_board_no_waterline", vcr_record: false do
18
+ sprint_board.setup('NzGCbEeN')
19
+ planning_board.setup('neUHHzDo')
20
+ sprint_board.place_waterline(planning_board.waterline_card)
21
+ end
22
+ end
@@ -0,0 +1,26 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe Scrum::SprintCleaner do
4
+ subject { described_class.new(dummy_settings) }
5
+
6
+ it "creates new sprint cleanup" do
7
+ expect(subject).to be
8
+ end
9
+
10
+ it "moves remaining cards to target board", vcr: "sprint_cleanup", vcr_record: false do
11
+ expect(STDOUT).to receive(:puts).exactly(12).times
12
+ expect(subject.cleanup("NzGCbEeN", "neUHHzDo")).to be
13
+ end
14
+
15
+ context "with non-existing target list on target board" do
16
+ before do
17
+ subject.settings.scrum.list_names["planning_ready"] = "Nonexisting List"
18
+ end
19
+
20
+ it "throws error", vcr: "sprint_cleanup", vcr_record: false do
21
+ expect {
22
+ subject.cleanup("NzGCbEeN", "neUHHzDo")
23
+ }.to raise_error /'Nonexisting List' not found/
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,14 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe Scrum::SprintPlanningBoard do
4
+ subject(:planning_board) { described_class.new(dummy_settings.scrum) }
5
+
6
+ before :each do
7
+ TrelloService.new(dummy_settings)
8
+ end
9
+
10
+ it "has a waterline card", vcr: "sprint_planning_board", vcr_record: false do
11
+ planning_board.setup('neUHHzDo')
12
+ expect(planning_board.waterline_card).to be
13
+ end
14
+ end