Sha256: 33936062dac1458b8ec873a54966442f1e45cf52692fdb1d0c040699850a44a6

Contents?: true

Size: 1.65 KB

Versions: 112

Compression:

Stored size: 1.65 KB

Contents

require 'spec_helper'

describe Twilio::Request do
  before do
    @request = Twilio::Request.new('host',
                                   'port',
                                   'POST',
                                   'url',
                                   { 'param-key' => 'param-value', 'param-keytwo' => 'param-valuetwo' },
                                   { 'data-key' => 'data-value', 'data-keytwo' => 'data-valuetwo' },
                                   { 'header-key' => 'header-value', 'header-keytwo' => 'header-valuetwo' },
                                   ['a', 'b'],
                                   'timeout')
  end

  it 'should initialize readers correctly' do
    expect(@request.host).to eq('host')
    expect(@request.port).to eq('port')
    expect(@request.method).to eq('POST')
    expect(@request.url).to eq('url')
    expect(@request.params).to eq('param-key' => 'param-value', 'param-keytwo' => 'param-valuetwo')
    expect(@request.data).to eq('data-key' => 'data-value', 'data-keytwo' => 'data-valuetwo')
    expect(@request.headers).to eq('header-key' => 'header-value', 'header-keytwo' => 'header-valuetwo')
    expect(@request.auth).to eq(['a', 'b'])
    expect(@request.timeout).to eq('timeout')
  end

  it 'should be represented correctly' do
    expected_string = %((a,b) POST url?param-key=param-value&param-keytwo=param-valuetwo) +
                      %(\n-d "data-key"="data-value") +
                      %(\n-d "data-keytwo"="data-valuetwo") +
                      %(\n-H "header-key": "header-value") +
                      %(\n-H "header-keytwo": "header-valuetwo")
    expect(@request.to_s).to eq(expected_string)
  end
end

Version data entries

112 entries across 112 versions & 1 rubygems

Version Path
twilio-ruby-5.39.0 spec/framework/request_spec.rb
twilio-ruby-5.38.0 spec/framework/request_spec.rb
twilio-ruby-5.37.0 spec/framework/request_spec.rb
twilio-ruby-5.36.0 spec/framework/request_spec.rb
twilio-ruby-5.35.0 spec/framework/request_spec.rb
twilio-ruby-5.34.1 spec/framework/request_spec.rb
twilio-ruby-5.34.0 spec/framework/request_spec.rb
twilio-ruby-5.33.1 spec/framework/request_spec.rb
twilio-ruby-5.33.0 spec/framework/request_spec.rb
twilio-ruby-5.32.0 spec/framework/request_spec.rb
twilio-ruby-5.31.6 spec/framework/request_spec.rb
twilio-ruby-5.31.5 spec/framework/request_spec.rb
twilio-ruby-5.31.4 spec/framework/request_spec.rb
twilio-ruby-5.31.3 spec/framework/request_spec.rb
twilio-ruby-5.31.2 spec/framework/request_spec.rb
twilio-ruby-5.31.1 spec/framework/request_spec.rb
twilio-ruby-5.31.0 spec/framework/request_spec.rb
twilio-ruby-5.30.0 spec/framework/request_spec.rb
twilio-ruby-5.29.1 spec/framework/request_spec.rb
twilio-ruby-5.29.0 spec/framework/request_spec.rb