Skip to content

Commit aa67292

Browse files
Copilotmanisha1997
andauthored
test: Add comprehensive delete method status code tests (#767)
* Initial plan * Add comprehensive tests for delete method with various status codes Co-authored-by: manisha1997 <28821901+manisha1997@users.noreply.github.com> * Add vendor/bundle to .gitignore and remove from repository Co-authored-by: manisha1997 <28821901+manisha1997@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: manisha1997 <28821901+manisha1997@users.noreply.github.com>
1 parent 3b11173 commit aa67292

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ docs/_build
1919

2020

2121
coverage
22+
vendor/bundle

spec/framework/version_spec.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,44 @@
216216

217217
expect(actual).to_not eq(nil)
218218
end
219+
220+
describe 'delete' do
221+
it 'succeeds with status code 204' do
222+
@holodeck.mock(Twilio::Response.new(204, ''))
223+
actual = @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete
224+
expect(actual).to eq(true)
225+
end
226+
227+
it 'succeeds with status code 200' do
228+
@holodeck.mock(Twilio::Response.new(200, ''))
229+
actual = @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete
230+
expect(actual).to eq(true)
231+
end
232+
233+
it 'succeeds with status code 202' do
234+
@holodeck.mock(Twilio::Response.new(202, ''))
235+
actual = @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete
236+
expect(actual).to eq(true)
237+
end
238+
239+
it 'succeeds with 3xx redirect code (307)' do
240+
@holodeck.mock(Twilio::Response.new(307, ''))
241+
actual = @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete
242+
expect(actual).to eq(true)
243+
end
244+
245+
it 'fails with 4xx error code (404)' do
246+
@holodeck.mock(Twilio::Response.new(404, '{"message": "Not found"}'))
247+
expect {
248+
@client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete
249+
}.to raise_error(Twilio::REST::RestError)
250+
end
251+
252+
it 'fails with 5xx error code (500)' do
253+
@holodeck.mock(Twilio::Response.new(500, '{"message": "Internal server error"}'))
254+
expect {
255+
@client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete
256+
}.to raise_error(Twilio::REST::RestError)
257+
end
258+
end
219259
end

0 commit comments

Comments
 (0)