spec/integration/chat/v2/service/channel/message_spec.rb in twilio-ruby-5.1.2 vs spec/integration/chat/v2/service/channel/message_spec.rb in twilio-ruby-5.2.0
- old
+ new
@@ -6,11 +6,11 @@
require 'spec_helper.rb'
describe 'Message' do
it "can fetch" do
- @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
+ @holodeck.mock(Twilio::Response.new(500, ''))
expect {
@client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
.channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
.messages("IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
@@ -23,21 +23,22 @@
url: 'https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
))).to eq(true)
end
it "receives fetch responses" do
- @holodeck.mock(Twilio::TwilioResponse.new(
+ @holodeck.mock(Twilio::Response.new(
200,
%q[
{
"sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date_created": "2016-03-24T20:37:57Z",
"date_updated": "2016-03-24T20:37:57Z",
+ "last_updated_by": null,
"was_edited": false,
"from": "system",
"attributes": "{}",
"body": "Hello",
"index": 0,
@@ -54,21 +55,22 @@
expect(actual).to_not eq(nil)
end
it "receives fetch_media responses" do
- @holodeck.mock(Twilio::TwilioResponse.new(
+ @holodeck.mock(Twilio::Response.new(
200,
%q[
{
"sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date_created": "2016-03-24T20:37:57Z",
"date_updated": "2016-03-24T20:37:57Z",
+ "last_updated_by": null,
"was_edited": false,
"from": "system",
"attributes": "{}",
"body": "Hello",
"index": 0,
@@ -90,11 +92,11 @@
expect(actual).to_not eq(nil)
end
it "can create" do
- @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
+ @holodeck.mock(Twilio::Response.new(500, ''))
expect {
@client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
.channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
.messages.create(body: "body")
@@ -110,11 +112,11 @@
data: values,
))).to eq(true)
end
it "receives create responses" do
- @holodeck.mock(Twilio::TwilioResponse.new(
+ @holodeck.mock(Twilio::Response.new(
201,
%q[
{
"sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -122,10 +124,11 @@
"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",
@@ -140,25 +143,26 @@
.messages.create(body: "body")
expect(actual).to_not eq(nil)
end
- it "receives create_with_attributes responses" do
- @holodeck.mock(Twilio::TwilioResponse.new(
+ it "receives create_with_all responses" do
+ @holodeck.mock(Twilio::Response.new(
201,
%q[
{
"sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
- "date_created": "2016-03-24T20:37:57Z",
- "date_updated": "2016-03-24T20:37:57Z",
- "was_edited": false,
+ "date_created": "2015-12-16T22:18:37Z",
+ "date_updated": "2015-12-16T22:18:38Z",
+ "last_updated_by": "username",
+ "was_edited": true,
"from": "system",
- "attributes": "{}",
+ "attributes": "{\\"test\\": \\"test\\"}",
"body": "Hello",
"index": 0,
"type": "text",
"media": null,
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@@ -172,11 +176,11 @@
expect(actual).to_not eq(nil)
end
it "can read" do
- @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
+ @holodeck.mock(Twilio::Response.new(500, ''))
expect {
@client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
.channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
.messages.list()
@@ -189,11 +193,11 @@
url: 'https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages',
))).to eq(true)
end
it "receives read_full responses" do
- @holodeck.mock(Twilio::TwilioResponse.new(
+ @holodeck.mock(Twilio::Response.new(
200,
%q[
{
"meta": {
"page": 0,
@@ -211,10 +215,11 @@
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date_created": "2016-03-24T20:37:57Z",
"date_updated": "2016-03-24T20:37:57Z",
+ "last_updated_by": null,
"was_edited": false,
"from": "system",
"attributes": "{}",
"body": "Hello",
"index": 0,
@@ -228,10 +233,11 @@
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date_created": "2016-03-24T20:37:57Z",
"date_updated": "2016-03-24T20:37:57Z",
+ "last_updated_by": null,
"was_edited": false,
"from": "system",
"attributes": "{}",
"body": "Hello",
"index": 0,
@@ -255,11 +261,11 @@
expect(actual).to_not eq(nil)
end
it "receives read_empty responses" do
- @holodeck.mock(Twilio::TwilioResponse.new(
+ @holodeck.mock(Twilio::Response.new(
200,
%q[
{
"meta": {
"page": 0,
@@ -281,11 +287,11 @@
expect(actual).to_not eq(nil)
end
it "can delete" do
- @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
+ @holodeck.mock(Twilio::Response.new(500, ''))
expect {
@client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
.channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
.messages("IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
@@ -298,11 +304,11 @@
url: 'https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
))).to eq(true)
end
it "receives delete responses" do
- @holodeck.mock(Twilio::TwilioResponse.new(
+ @holodeck.mock(Twilio::Response.new(
204,
nil,
))
actual = @client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
@@ -311,11 +317,11 @@
expect(actual).to eq(true)
end
it "can update" do
- @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
+ @holodeck.mock(Twilio::Response.new(500, ''))
expect {
@client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
.channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
.messages("IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
@@ -328,22 +334,23 @@
url: 'https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
))).to eq(true)
end
it "receives update responses" do
- @holodeck.mock(Twilio::TwilioResponse.new(
+ @holodeck.mock(Twilio::Response.new(
200,
%q[
{
"sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
- "attributes": "{\\"test\\": \\"test\\"}",
- "date_created": "2016-03-24T20:37:57Z",
- "date_updated": "2016-03-24T20:37:57Z",
- "was_edited": false,
+ "attributes": "{ \\"foo\\": \\"bar\\" }",
+ "date_created": "2015-12-16T22:18:37Z",
+ "date_updated": "2015-12-16T22:18:38Z",
+ "last_updated_by": "username",
+ "was_edited": true,
"from": "system",
"body": "Hello",
"index": 0,
"type": "text",
"media": null,
\ No newline at end of file