Sha256: 2ddb11d480bedbcb09c48ad56d57966d6e24327ed713c8d3117373a57a543790

Contents?: true

Size: 1.2 KB

Versions: 11

Compression:

Stored size: 1.2 KB

Contents

##
# This code was generated by
# \ / _    _  _|   _  _
#  | (_)\/(_)(_|\/| |(/_  v1.0.0
#       /       /
#
# frozen_string_literal: true

require 'spec_helper.rb'

describe 'Device' do
  it "can create" do
    @holodeck.mock(Twilio::Response.new(500, ''))

    expect {
      @client.preview.trusted_comms.devices.create(phone_number: 'phone_number', push_token: 'push_token')
    }.to raise_exception(Twilio::REST::TwilioError)

    values = {'PhoneNumber' => 'phone_number', 'PushToken' => 'push_token', }
    expect(
    @holodeck.has_request?(Holodeck::Request.new(
        method: 'post',
        url: 'https://preview.twilio.com/TrustedComms/Devices',
        data: values,
    ))).to eq(true)
  end

  it "receives create responses" do
    @holodeck.mock(Twilio::Response.new(
        201,
      %q[
      {
          "sid": "DDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "binding_sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "phone_number": "+573000000000",
          "url": "https://preview.twilio.com/TrustedComms/Devices"
      }
      ]
    ))

    actual = @client.preview.trusted_comms.devices.create(phone_number: 'phone_number', push_token: 'push_token')

    expect(actual).to_not eq(nil)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
twilio-ruby-5.28.0 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.27.1 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.27.0 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.26.0 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.25.4 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.25.3 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.25.2 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.25.1 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.25.0 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.24.0 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.23.1 spec/integration/preview/trusted_comms/device_spec.rb