Skip to content

Commit

Permalink
Merge 4afc910 into 7643de3
Browse files Browse the repository at this point in the history
  • Loading branch information
esigler committed Jul 17, 2015
2 parents 7643de3 + 4afc910 commit 1e3c35d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
9 changes: 6 additions & 3 deletions lib/lita/handlers/locker_labels.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ class LockerLabels < Handler
)

def list(response)
Label.list.each do |n|
l = Label.new(n)
response.reply(unlocked(t('label.desc', name: n, state: l.state.value)))
Label.list.each_slice(10) do |slice|
slice.each do |n|
l = Label.new(n)
response.reply(unlocked(t('label.desc', name: n, state: l.state.value)))
end
sleep 1
end
end

Expand Down
11 changes: 6 additions & 5 deletions lib/lita/handlers/locker_resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ class LockerResources < Handler
)

def list(response)
output = ''
Resource.list.each do |r|
res = Resource.new(r)
output += t('resource.desc', name: r, state: res.state.value)
Resource.list.each_slice(10) do |slice|
slice.each do |r|
res = Resource.new(r)
response.reply(t('resource.desc', name: r, state: res.state.value))
end
sleep 1
end
response.reply(output)
end

def create(response)
Expand Down
4 changes: 2 additions & 2 deletions spec/lita/handlers/locker_resources_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
send_command('locker resource create foobar')
send_command('locker resource create bazbat')
send_command('locker resource list')
expect(replies.last).to match(/Resource: foobar, state: unlocked/)
expect(replies.last).to match(/Resource: bazbat, state: unlocked/)
expect(replies).to include('Resource: foobar, state: unlocked')
expect(replies).to include('Resource: bazbat, state: unlocked')
end
end

Expand Down

0 comments on commit 1e3c35d

Please sign in to comment.