File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed
spec/slack/web/api/mixins Expand file tree Collapse file tree 2 files changed +36
-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+ after { Slack ::Web . config . reset }
55+
56+ it 'translates a channel that starts with a #' do
57+ expect ( conversations ) . to receive ( :conversations_list ) . with ( limit : 500 )
58+ expect ( conversations . conversations_id ( channel : '#general' ) ) . to (
59+ eq ( 'ok' => true , 'channel' => { 'id' => 'CDEADBEEF' } )
60+ )
61+ end
62+
63+ it 'forwards a provided limit to the underlying conversations_list calls' do
64+ expect ( conversations ) . to receive ( :conversations_list ) . with ( limit : 1234 )
65+ conversations . conversations_id ( channel : '#general' , id_limit : 1234 )
66+ end
67+ end
5068 end
5169end
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+ after { Slack ::Web . config . reset }
52+
53+ it 'translates a user that starts with a @' do
54+ expect ( users ) . to receive ( :users_list ) . with ( limit : 500 )
55+ expect ( users . users_id ( user : '@aws' ) ) . to eq ( 'ok' => true , 'user' => { 'id' => 'UDEADBEEF' } )
56+ end
57+
58+ it 'forwards a provided limit to the underlying users_list calls' do
59+ expect ( users ) . to receive ( :users_list ) . with ( limit : 1234 )
60+ users . users_id ( user : '@aws' , id_limit : 1234 )
61+ end
62+ end
4763 end
4864
4965 if defined? ( Picky )
You can’t perform that action at this time.
0 commit comments