File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def save
4848
4949 # convert to `tweet_ids` param
5050 params = to_params
51- params [ :tweet_ids ] = * params . delete ( :tweet_id ) if params . key? ( :tweet_id )
51+ params [ :tweet_ids ] = params . delete ( :tweet_id ) if params . key? ( :tweet_id )
5252
5353 if @id
5454 raise TwitterAds ::NotFound . new ( nil , 'Method PUT not allowed.' , 404 )
Original file line number Diff line number Diff line change 4141 expect { subject . save } . to raise_error ( TwitterAds ::ClientError )
4242 end
4343
44+ it 'sets params[:tweet_ids] from params[:tweet_id]' do
45+ request = double ( 'request' )
46+ response = double ( 'response' )
47+ allow ( response ) . to receive ( :body ) . and_return ( { data : [ { } ] } )
48+ allow ( request ) . to receive ( :perform ) . and_return ( response )
49+ expected_params = { params : { line_item_id : '12345' , tweet_ids : 99999999999999999999 } }
50+
51+ expect ( Request ) . to receive ( :new ) . with (
52+ client ,
53+ :post ,
54+ "/#{ TwitterAds ::API_VERSION } /accounts/#{ account . id } /promoted_tweets" ,
55+ expected_params
56+ ) . and_return ( request )
57+
58+ subject . line_item_id = '12345'
59+ subject . tweet_id = 99999999999999999999
60+ subject . save
61+ end
4462 end
4563
4664end
You can’t perform that action at this time.
0 commit comments