lita-locker 1.0.2 → 1.0.3
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/locker_misc.rb +5 -0
- data/lita-locker.gemspec +1 -1
- data/spec/lita/handlers/locker_misc_spec.rb +13 -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: 51d68722a9a837146295120ccd13ec48d9135bbe
|
4
|
+
data.tar.gz: a821ec80a688f3b6ff13cae131d6fddb3c2233a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 793ac5553e20c774572bc4f558c9badc5086b03689c5bcb8f5f48e2e5acc0d9633940a3f0bb1e3d509450fbfb47a93682477f20166e970b383e3c177b0acbef1
|
7
|
+
data.tar.gz: f7c7b6596d3b5d1a5b7eadedcdd9c0fad27cc929cfd4a650da06890cfb43227cf01b4d259542cc050466e95583c8955b0e79de14e790d6bce647db69a5ff427e
|
@@ -58,6 +58,11 @@ module Lita
|
|
58
58
|
return response.reply(t('subject.does_not_exist', name: name)) unless Label.exists?(name)
|
59
59
|
l = Label.new(name)
|
60
60
|
l.wait_queue.delete(response.user.id)
|
61
|
+
queued = l.wait_queue.to_a
|
62
|
+
l.wait_queue.clear
|
63
|
+
queued.chunk { |x| x }.map(&:first).each do |user|
|
64
|
+
l.wait_queue << user
|
65
|
+
end
|
61
66
|
response.reply(t('label.removed_from_queue', name: name))
|
62
67
|
end
|
63
68
|
|
data/lita-locker.gemspec
CHANGED
@@ -69,6 +69,19 @@ describe Lita::Handlers::LockerMisc, lita_handler: true do
|
|
69
69
|
send_command('locker dequeue foo', as: bob)
|
70
70
|
expect(replies.last).to eq('You have been removed from the queue for foo')
|
71
71
|
end
|
72
|
+
|
73
|
+
it 'avoids adjacent duplicates in the queue when a sandwiched dequeue occurs' do
|
74
|
+
send_command('locker resource create bar')
|
75
|
+
send_command('locker label create foo')
|
76
|
+
send_command('locker label add bar to foo')
|
77
|
+
send_command('lock foo', as: alice)
|
78
|
+
send_command('lock foo', as: bob)
|
79
|
+
send_command('lock foo', as: doris)
|
80
|
+
send_command('lock foo', as: bob)
|
81
|
+
send_command('locker dequeue foo', as: doris)
|
82
|
+
send_command('locker status foo')
|
83
|
+
expect(replies.last).to eq('foo is locked by Alice (taken 1 second ago). Next up: Bob')
|
84
|
+
end
|
72
85
|
end
|
73
86
|
|
74
87
|
describe '#status' do
|