-
-
Notifications
You must be signed in to change notification settings - Fork 223
More efficient name-to-id translation #555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
f2e0b8f
102a461
4a87569
b116415
a6a86d1
8d73e21
1f777a9
9bc08a7
6681fda
e4c2fdc
c6e0869
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,15 +31,39 @@ | |
| end | ||
|
|
||
| it 'translates a channel that starts with a #' do | ||
| expect(conversations).to receive(:conversations_list).with(limit: 100) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a change in default behavior isn't it? This test doesn't pass without the changes.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yes - the old code relies on the default from within the paginator. |
||
| expect(conversations.conversations_id(channel: '#general')).to( | ||
| eq('ok' => true, 'channel' => { 'id' => 'CDEADBEEF' }) | ||
| ) | ||
| end | ||
|
|
||
| it 'forwards a provided limit to the underlying conversations_list calls' do | ||
| expect(conversations).to receive(:conversations_list).with(limit: 1234) | ||
| conversations.conversations_id(channel: '#general', id_limit: 1234) | ||
| end | ||
|
|
||
| it 'fails with an exception' do | ||
| expect { conversations.conversations_id(channel: '#invalid') }.to( | ||
| raise_error(Slack::Web::Api::Errors::SlackError, 'channel_not_found') | ||
| ) | ||
| end | ||
|
|
||
| context 'when a non-default conversations_id page size has been configured' do | ||
| before { Slack::Web.config.conversations_id_page_size = 500 } | ||
|
|
||
| after { Slack::Web.config.reset } | ||
|
|
||
| it 'translates a channel that starts with a #' do | ||
| expect(conversations).to receive(:conversations_list).with(limit: 500) | ||
| expect(conversations.conversations_id(channel: '#general')).to( | ||
| eq('ok' => true, 'channel' => { 'id' => 'CDEADBEEF' }) | ||
| ) | ||
| end | ||
|
|
||
| it 'forwards a provided limit to the underlying conversations_list calls' do | ||
| expect(conversations).to receive(:conversations_list).with(limit: 1234) | ||
| conversations.conversations_id(channel: '#general', id_limit: 1234) | ||
| end | ||
| end | ||
| end | ||
| end | ||
Uh oh!
There was an error while loading. Please reload this page.