spec/lib/zoom/actions/webinar/update_spec.rb in zoom_rb-0.8.1 vs spec/lib/zoom/actions/webinar/update_spec.rb in zoom_rb-0.8.2
- old
+ new
@@ -5,36 +5,40 @@
describe Zoom::Actions::Webinar do
let(:zc) { zoom_client }
let(:args) { { id: '123456789' } }
describe '#webinar_update' do
- before :each do
- stub_request(
- :patch,
- zoom_url("/webinars/#{args[:id]}")
- ).to_return(status: 204, body: json_response('webinar', 'update'))
- end
+ context 'with a valid response' do
+ before :each do
+ stub_request(
+ :patch,
+ zoom_url("/webinars/#{args[:id]}")
+ ).to_return(status: 204,
+ body: json_response('webinar', 'update'),
+ headers: {"Content-Type"=> "application/json"})
+ end
- it "requires a 'id' argument" do
- expect { zc.webinar_update(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
- end
+ it "requires a 'id' argument" do
+ expect { zc.webinar_update(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
+ end
- it 'returns the http status code as a number' do
- expect(zc.webinar_update(args)).to eql(204)
+ it 'returns the http status code as a number' do
+ expect(zc.webinar_update(args)).to eql(204)
+ end
end
- end
- describe '#webinar_update!' do
- before :each do
- stub_request(
- :patch,
- zoom_url("/webinars/#{args[:id]}")
- ).to_return(status: 404, body: json_response('error', 'validation'))
- end
+ context 'with a 4xx response' do
+ before :each do
+ stub_request(
+ :patch,
+ zoom_url("/webinars/#{args[:id]}")
+ ).to_return(status: 404,
+ body: json_response('error', 'not_found'),
+ headers: {"Content-Type"=> "application/json"})
+ end
- it 'raises Zoom::Error exception' do
- expect {
- zc.webinar_update!(args)
- }.to raise_error(Zoom::Error)
+ it 'raises an error' do
+ expect { zc.webinar_update(args) }.to raise_error(Zoom::Error)
+ end
end
end
end