lita-estimate 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lita/handlers/estimate.rb +10 -3
- data/lita-estimate.gemspec +1 -1
- data/spec/lita/handlers/estimate_spec.rb +21 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d04887b4c71293d42db3b4977754346b8a425ce
|
4
|
+
data.tar.gz: 8b667c0dccdf5bd40bd9dabb3fd432c95c82ed8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a86fafa98a6cf0757adad7c27ea0dfc6eb033f9e27cad766ec83ef5894f2de78988de0e324d94df98e3290a2ade34677e0da102ab92d0e342b95c400ad983d6a
|
7
|
+
data.tar.gz: 150157f64e780ce2d507106828951095adba5170115142700b9305c415926eecb9b48b2e08fcd8881dc09e93dc4267035da112143c08dc86fb7772c0eca167cb
|
@@ -2,9 +2,10 @@ module Lita
|
|
2
2
|
module Handlers
|
3
3
|
class Estimate < Handler
|
4
4
|
|
5
|
-
route
|
6
|
-
route
|
7
|
-
route
|
5
|
+
route /\Aestimate ([A-Za-z0-9_.-]+) as (\d+)\Z/, :estimate, command: true, help: {"estimate STORY_ID as FIBONACCI_NUMBER" => "Records your estimate for the story"}
|
6
|
+
route /\A([A-Za-z0-9_.-]+) estimates\Z/, :show_estimates, command: true, help: {"STORY_ID estimates" => "Lists all estimates for the story and their average"}
|
7
|
+
route /\A([A-Za-z0-9_.-]+) estimators\Z/, :show_estimators, command: true, help: {"STORY_ID estimators" => "Lists all estimators for the story"}
|
8
|
+
route /\A([A-Za-z0-9_.-]+) estimates reset\Z/, :reset_estimates, command: true, help: {"STORY_ID estimates reset" => "Reset all estimates for the story"}
|
8
9
|
|
9
10
|
def estimate(response)
|
10
11
|
story, points = response.matches.first
|
@@ -34,6 +35,12 @@ module Lita
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
38
|
+
def reset_estimates(response)
|
39
|
+
story = response.matches.flatten.first
|
40
|
+
redis.del(key(story))
|
41
|
+
response.reply("Estimates reset for #{story}")
|
42
|
+
end
|
43
|
+
|
37
44
|
def key(story)
|
38
45
|
['estimate', story].join(':')
|
39
46
|
end
|
data/lita-estimate.gemspec
CHANGED
@@ -8,6 +8,7 @@ describe Lita::Handlers::Estimate, lita_handler: true do
|
|
8
8
|
it { is_expected.to route_command("estimate #{story_format} as 1").to(:estimate) }
|
9
9
|
it { is_expected.to route_command("#{story_format} estimates").to(:show_estimates) }
|
10
10
|
it { is_expected.to route_command("#{story_format} estimators").to(:show_estimators) }
|
11
|
+
it { is_expected.to route_command("#{story_format} estimates reset").to(:reset_estimates) }
|
11
12
|
end
|
12
13
|
|
13
14
|
end
|
@@ -70,4 +71,24 @@ describe Lita::Handlers::Estimate, lita_handler: true do
|
|
70
71
|
|
71
72
|
end
|
72
73
|
|
74
|
+
describe "reset estimates" do
|
75
|
+
|
76
|
+
before(:each) do
|
77
|
+
subject.redis.hset('estimate:US123', 'Peter', '5')
|
78
|
+
subject.redis.hset('estimate:US123', 'Paula', '3')
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should reset estimates" do
|
82
|
+
send_command('US123 estimates reset')
|
83
|
+
expect(subject.redis.hgetall('estimate:US123')).to eq({})
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should confirm the reset" do
|
87
|
+
send_command('US123 estimates reset')
|
88
|
+
expect(replies.size).to eq(1)
|
89
|
+
expect(replies.last).to eq("Estimates reset for US123")
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
73
94
|
end
|