spec/integration/conversations/v1/conversation/participant_spec.rb in twilio-ruby-5.38.0 vs spec/integration/conversations/v1/conversation/participant_spec.rb in twilio-ruby-5.39.0

- old
+ new

@@ -12,18 +12,19 @@ it "can create" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .participants.create() + .participants.create(x_twilio_webhook_enabled: 'true') }.to raise_exception(Twilio::REST::TwilioError) - values = {} + headers = {'X-Twilio-Webhook-Enabled' => 'true', } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants', + headers: headers, ))).to eq(true) end it "receives create_sms responses" do @holodeck.mock(Twilio::Response.new( @@ -110,18 +111,19 @@ it "can update" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update() + .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(x_twilio_webhook_enabled: 'true') }.to raise_exception(Twilio::REST::TwilioError) - values = {} + headers = {'X-Twilio-Webhook-Enabled' => 'true', } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', + headers: headers, ))).to eq(true) end it "receives update responses" do @holodeck.mock(Twilio::Response.new( @@ -150,23 +152,52 @@ .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update() expect(actual).to_not eq(nil) end + it "receives update_gmms responses" do + @holodeck.mock(Twilio::Response.new( + 200, + %q[ + { + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "identity": "id", + "attributes": "{ \\"role\\": \\"driver\\" }", + "messaging_binding": { + "type": "sms", + "projected_address": "+15017122661" + }, + "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_created": "2015-12-16T22:18:37Z", + "date_updated": "2015-12-16T22:18:38Z", + "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ] + )) + + actual = @client.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ + .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update() + + expect(actual).to_not eq(nil) + end + it "can delete" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() + .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete(x_twilio_webhook_enabled: 'true') }.to raise_exception(Twilio::REST::TwilioError) - values = {} + headers = {'X-Twilio-Webhook-Enabled' => 'true', } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'delete', url: 'https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', + headers: headers, ))).to eq(true) end it "receives delete responses" do @holodeck.mock(Twilio::Response.new( @@ -186,11 +217,10 @@ expect { @client.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() }.to raise_exception(Twilio::REST::TwilioError) - values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ))).to eq(true) @@ -231,10 +261,9 @@ expect { @client.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .participants.list() }.to raise_exception(Twilio::REST::TwilioError) - values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants', ))).to eq(true) \ No newline at end of file