Sha256: 5c7642f28a60e7359e1e7ab1a496cbf70ef55371b9dfde87e499b9074a3e696f

Contents?: true

Size: 1.2 KB

Versions: 9

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[
      {
          "binding_sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "phone_number": "+573000000000",
          "sid": "DDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "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

9 entries across 9 versions & 1 rubygems

Version Path
twilio-ruby-5.31.5 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.31.4 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.31.3 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.31.2 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.31.1 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.31.0 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.30.0 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.29.1 spec/integration/preview/trusted_comms/device_spec.rb
twilio-ruby-5.29.0 spec/integration/preview/trusted_comms/device_spec.rb