Sha256: 6c240538a3e12ec655e3a8fd9252256d24472395215474e9baa08087ce6c32f9

Contents?: true

Size: 1.69 KB

Versions: 12

Compression:

Stored size: 1.69 KB

Contents

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

require 'spec_helper.rb'

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

    expect {
      @client.preview.trusted_comms.branded_channels('BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
                                   .channels.create(phone_number_sid: 'PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
    }.to raise_exception(Twilio::REST::TwilioError)

    values = {'PhoneNumberSid' => 'PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', }
    expect(
    @holodeck.has_request?(Holodeck::Request.new(
        method: 'post',
        url: 'https://preview.twilio.com/TrustedComms/BrandedChannels/BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels',
        data: values,
    ))).to eq(true)
  end

  it "receives create responses" do
    @holodeck.mock(Twilio::Response.new(
        201,
      %q[
      {
          "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "business_sid": "BXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "brand_sid": "BZaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "branded_channel_sid": "BWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "phone_number_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "phone_number": "+15000000000",
          "url": "https://preview.twilio.com/TrustedComms/BrandedChannels/BWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels"
      }
      ]
    ))

    actual = @client.preview.trusted_comms.branded_channels('BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
                                          .channels.create(phone_number_sid: 'PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
twilio-ruby-5.50.0 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.49.0 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.48.0 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.47.0 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.46.1 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.46.0 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.45.1 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.45.0 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.44.0 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.43.0 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.42.0 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb
twilio-ruby-5.41.0 spec/integration/preview/trusted_comms/branded_channel/channel_spec.rb