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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26916839a60cffe50793e06c37f462932563df96
4
- data.tar.gz: 4ff2792b3d469b34355a48018f205d6db0328db4
3
+ metadata.gz: 6d04887b4c71293d42db3b4977754346b8a425ce
4
+ data.tar.gz: 8b667c0dccdf5bd40bd9dabb3fd432c95c82ed8e
5
5
  SHA512:
6
- metadata.gz: 7f6c696e10214cb3d8f699ccacb8443a0a7e5be91e2d2fdc0649393d044e1e6c64f1e43b04050b1a7d2445aaa2af95516ae4b102db31865d88c1e2d87c6d9d3c
7
- data.tar.gz: 6254becc8e51b85da9c3623d8e2ba4da58164a796b5c2076aa9f121e72bb920dfa526f204779b255a2c5f5b95e8dd35d0b3494ad7488d552b669b29800d065f3
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 /estimate ([A-Za-z0-9_.-]+) as (\d+)/, :estimate, command: true, help: {"estimate STORY_ID as FIBONACCI_NUMBER" => "Records your estimate for the story"}
6
- route /([A-Za-z0-9_.-]+) estimates/, :show_estimates, command: true, help: {"STORY_ID estimates" => "Lists all estimates for the story and their average"}
7
- route /([A-Za-z0-9_.-]+) estimators/, :show_estimators, command: true, help: {"STORY_ID estimators" => "Lists all estimators for the story"}
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-estimate"
3
- spec.version = "0.1.3"
3
+ spec.version = "0.1.4"
4
4
  spec.authors = ["Ingo Weiss"]
5
5
  spec.email = ["ingo@ingoweiss.com"]
6
6
  spec.description = "Just a silly little Lita plugin for estimation"
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-estimate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ingo Weiss