spec/integration/chat/v2/service/channel/message_spec.rb in twilio-ruby-5.2.3 vs spec/integration/chat/v2/service/channel/message_spec.rb in twilio-ruby-5.3.0

- old
+ new

@@ -97,21 +97,18 @@ @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ - .messages.create(body: "body") + .messages.create() }.to raise_exception(Twilio::REST::TwilioError) - values = { - 'Body' => "body", - } + values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages', - data: values, ))).to eq(true) end it "receives create responses" do @holodeck.mock(Twilio::Response.new( @@ -138,11 +135,11 @@ ] )) actual = @client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ - .messages.create(body: "body") + .messages.create() expect(actual).to_not eq(nil) end it "receives create_with_all responses" do @@ -170,10 +167,47 @@ ] )) actual = @client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ - .messages.create(body: "body") + .messages.create() + + expect(actual).to_not eq(nil) + end + + it "receives create_media responses" do + @holodeck.mock(Twilio::Response.new( + 201, + %q[ + { + "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "attributes": null, + "date_created": "2016-03-24T20:37:57Z", + "date_updated": "2016-03-24T20:37:57Z", + "last_updated_by": "system", + "was_edited": false, + "from": "system", + "body": "Hello", + "index": 0, + "type": "text", + "media": { + "sid": "MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "size": 99999999999999, + "content_type": "application/pdf", + "filename": "hello.pdf" + }, + "url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ] + )) + + actual = @client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ + .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ + .messages.create() expect(actual).to_not eq(nil) end it "can read" do \ No newline at end of file