Skip to content

Commit

Permalink
Reversal of a previous modification concerning Webhook#update_webhook
Browse files Browse the repository at this point in the history
  Finally, after doing my tests on the latest version of Rspec, and looking at the code, I realize that the modification was not necessary, and PixeLInc was right in his PR shardlab#199
  • Loading branch information
Dakurei committed Mar 28, 2023
1 parent ed65d64 commit 0327e7c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/webhooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

if event.message.content == 'EDIT_TWO'
wh = event.channel.webhooks.first
wh.update(avatar: BASE64_SMALL_PICTURE, reason: 'Edition test two')
wh.update({ avatar: BASE64_SMALL_PICTURE, reason: 'Edition test two' })

puts wh.inspect
wh.execute(content: '[EDIT TWO]')
Expand Down
2 changes: 1 addition & 1 deletion lib/discordrb/data/webhook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def update(data)
data[:avatar] = avatarise(data[:avatar]) if data.key?(:avatar)
data[:channel_id] = data[:channel]&.resolve_id
data.delete(:channel)
update_webhook(**data)
update_webhook(data)
end

# Deletes the webhook.
Expand Down
2 changes: 1 addition & 1 deletion spec/data/webhook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

describe '#update' do
it 'calls update_webhook' do
expect(webhook).to receive(:update_webhook).with(avatar: avatar_string, channel_id: edited_webhook_channel_id.to_i, name: edited_webhook_name, reason: reason)
expect(webhook).to receive(:update_webhook).with(hash_including(avatar: avatar_string, channel_id: edited_webhook_channel_id.to_i, name: edited_webhook_name, reason: reason))
webhook.update(avatar: avatar_string, channel: edited_webhook_channel_id, name: edited_webhook_name, reason: reason)
end
end
Expand Down

0 comments on commit 0327e7c

Please sign in to comment.