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.20.0 spec/framework/request_spec.rb
twilio-ruby-5.19.0 spec/framework/request_spec.rb
twilio-ruby-5.18.0 spec/framework/request_spec.rb
twilio-ruby-5.17.0 spec/framework/request_spec.rb
twilio-ruby-5.16.0 spec/framework/request_spec.rb
twilio-ruby-5.15.2 spec/framework/request_spec.rb
twilio-ruby-5.15.1 spec/framework/request_spec.rb
twilio-ruby-5.15.0 spec/framework/request_spec.rb
twilio-ruby-5.14.1 spec/framework/request_spec.rb
twilio-ruby-5.14.0 spec/framework/request_spec.rb
twilio-ruby-5.13.0 spec/framework/request_spec.rb
twilio-ruby-5.12.4 spec/framework/request_spec.rb
twilio-ruby-5.12.3 spec/framework/request_spec.rb
twilio-ruby-5.12.2 spec/framework/request_spec.rb
twilio-ruby-5.12.1 spec/framework/request_spec.rb
twilio-ruby-5.12.0 spec/framework/request_spec.rb
twilio-ruby-5.11.2 spec/framework/request_spec.rb
twilio-ruby-5.11.1 spec/framework/request_spec.rb
twilio-ruby-5.11.0 spec/framework/request_spec.rb
twilio-ruby-5.10.7 spec/framework/request_spec.rb