File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed
spec/slack/web/api/mixins Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 1313 end
1414
1515 before do
16- allow ( conversations ) . to receive ( :conversations_id_page_size ) . and_return ( 100 )
16+ allow ( conversations ) . to receive ( :conversations_id_page_size ) { Slack :: Web . config . conversations_id_page_size }
1717 allow ( conversations ) . to receive ( :conversations_list ) . and_yield (
1818 Slack ::Messages ::Message . new (
1919 'channels' => [ {
3232 end
3333
3434 it 'translates a channel that starts with a #' do
35+ expect ( conversations ) . to receive ( :conversations_list ) . with ( limit : 100 )
3536 expect ( conversations . conversations_id ( channel : '#general' ) ) . to (
3637 eq ( 'ok' => true , 'channel' => { 'id' => 'CDEADBEEF' } )
3738 )
4748 raise_error ( Slack ::Web ::Api ::Errors ::SlackError , 'channel_not_found' )
4849 )
4950 end
51+
52+ context 'when a non-default conversations_id page size has been configured' do
53+ before { Slack ::Web . config . conversations_id_page_size = 500 }
54+
55+ after { Slack ::Web . config . reset }
56+
57+ it 'translates a channel that starts with a #' do
58+ expect ( conversations ) . to receive ( :conversations_list ) . with ( limit : 500 )
59+ expect ( conversations . conversations_id ( channel : '#general' ) ) . to (
60+ eq ( 'ok' => true , 'channel' => { 'id' => 'CDEADBEEF' } )
61+ )
62+ end
63+
64+ it 'forwards a provided limit to the underlying conversations_list calls' do
65+ expect ( conversations ) . to receive ( :conversations_list ) . with ( limit : 1234 )
66+ conversations . conversations_id ( channel : '#general' , limit : 1234 )
67+ end
68+ end
5069 end
5170end
Original file line number Diff line number Diff line change 1313 end
1414
1515 before do
16- allow ( users ) . to receive ( :users_id_page_size ) . and_return ( 100 )
16+ allow ( users ) . to receive ( :users_id_page_size ) { Slack :: Web . config . users_id_page_size }
1717 allow ( users ) . to receive ( :users_list ) . and_yield (
1818 Slack ::Messages ::Message . new (
1919 'members' => [ {
3131 end
3232
3333 it 'translates a user that starts with a @' do
34+ expect ( users ) . to receive ( :users_list ) . with ( limit : 100 )
3435 expect ( users . users_id ( user : '@aws' ) ) . to eq ( 'ok' => true , 'user' => { 'id' => 'UDEADBEEF' } )
3536 end
3637
4445 raise_error ( Slack ::Web ::Api ::Errors ::SlackError , 'user_not_found' )
4546 )
4647 end
48+
49+ context 'when a non-default conversations_id page size has been configured' do
50+ before { Slack ::Web . config . users_id_page_size = 500 }
51+
52+ after { Slack ::Web . config . reset }
53+
54+ it 'translates a user that starts with a @' do
55+ expect ( users ) . to receive ( :users_list ) . with ( limit : 500 )
56+ expect ( users . users_id ( user : '@aws' ) ) . to eq ( 'ok' => true , 'user' => { 'id' => 'UDEADBEEF' } )
57+ end
58+
59+ it 'forwards a provided limit to the underlying users_list calls' do
60+ expect ( users ) . to receive ( :users_list ) . with ( limit : 1234 )
61+ users . users_id ( user : '@aws' , limit : 1234 )
62+ end
63+ end
4764 end
4865
4966 if defined? ( Picky )
You can’t perform that action at this time.
0 commit comments