61 lines
1.5 KiB
Ruby
61 lines
1.5 KiB
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe Zoom::Actions::User do
|
|
let(:wrapper) { Zoom.new }
|
|
|
|
describe '.update_user_settings' do
|
|
it 'raises exception if id param is missing' do
|
|
params = {
|
|
in_meeting: {
|
|
not_allowed_param: 1
|
|
}
|
|
}
|
|
|
|
expect do
|
|
wrapper.user_settings_update(params)
|
|
end.to raise_exception(Zoom::ParameterMissing)
|
|
end
|
|
|
|
it 'raises exception if not allowed param is present' do
|
|
params = {
|
|
id: 'dw3-3sd33',
|
|
in_meeting: {
|
|
not_allowed_param: 1
|
|
}
|
|
}
|
|
|
|
expect do
|
|
wrapper.user_settings_update(params)
|
|
end.to raise_exception(Zoom::ParameterNotPermitted)
|
|
end
|
|
|
|
it 'sends PATCH request to the Zoom API endpoint' do
|
|
params = {
|
|
id: 'zoom-120-id',
|
|
in_meeting: {
|
|
auto_saving_chat: true,
|
|
co_host: true,
|
|
non_verbal_feedback: true,
|
|
breakout_room: true,
|
|
group_hd: true,
|
|
far_end_camera_control: true,
|
|
allow_live_streaming: true
|
|
}
|
|
}
|
|
|
|
allow(Zoom::Utils).to receive(:parse_response).and_return 'Success!'
|
|
|
|
path = "/users/#{params[:id]}/settings"
|
|
body_params = { body: params.except(:id).to_json }
|
|
allow(wrapper.class)
|
|
.to receive(:patch)
|
|
.with(path, hash_including(body_params))
|
|
.and_return({})
|
|
|
|
mock_response = wrapper.user_settings_update params
|
|
expect(mock_response).to eq 'Success!'
|
|
end
|
|
end
|
|
|
|
end
|