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.50.0 spec/framework/request_spec.rb
twilio-ruby-5.49.0 spec/framework/request_spec.rb
twilio-ruby-5.48.0 spec/framework/request_spec.rb
twilio-ruby-5.47.0 spec/framework/request_spec.rb
twilio-ruby-5.46.1 spec/framework/request_spec.rb
twilio-ruby-5.46.0 spec/framework/request_spec.rb
twilio-ruby-5.45.1 spec/framework/request_spec.rb
twilio-ruby-5.45.0 spec/framework/request_spec.rb
twilio-ruby-5.44.0 spec/framework/request_spec.rb
twilio-ruby-5.43.0 spec/framework/request_spec.rb
twilio-ruby-5.42.0 spec/framework/request_spec.rb
twilio-ruby-5.41.0 spec/framework/request_spec.rb
twilio-ruby-5.40.4 spec/framework/request_spec.rb
twilio-ruby-5.40.3 spec/framework/request_spec.rb
twilio-ruby-5.40.2 spec/framework/request_spec.rb
twilio-ruby-5.40.1 spec/framework/request_spec.rb
twilio-ruby-5.40.0 spec/framework/request_spec.rb
twilio-ruby-5.39.3 spec/framework/request_spec.rb
twilio-ruby-5.39.2 spec/framework/request_spec.rb
twilio-ruby-5.39.1 spec/framework/request_spec.rb