Sha256: 314d6156302a671918fb16477a3729fe656ea8a66a2282a664a65c327b2b8c7b

Contents?: true

Size: 1.44 KB

Versions: 9

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

describe Typhoeus::Request do

    describe '#id' do
        it 'is accessible' do
            req = Typhoeus::Request.new( '' )
            req.id = 1
            req.id.should == 1
        end
    end

    describe '#on_complete' do
        context 'when multi is enabled' do
            it 'allows multiple callbacks' do
                req = Typhoeus::Request.new( '' )

                a = []
                req.on_complete( true ) { a << 1 }
                req.on_complete( true ) { a << 2 }
                req.on_complete{ a << 3 }

                req.call_handlers
                a.should == [1, 2, 3]
            end
        end

        it 'sets a single callback to handle the response' do
            req = Typhoeus::Request.new( '' )

            a = []
            req.on_complete { a << 1 }
            req.on_complete { a << 2 }

            req.call_handlers
            a.should == [2]
        end
    end

    describe '#train' do
        it 'sets train? to return true' do
            req = Typhoeus::Request.new( '' )
            req.train?.should be_false
            req.train
            req.train?.should be_true
        end
    end

    describe '#update_cookies' do
        it 'sets update_cookies? to return true' do
            req = Typhoeus::Request.new( '' )
            req.update_cookies?.should be_false
            req.update_cookies
            req.update_cookies?.should be_true
        end
    end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
arachni-0.4.7 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.6 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.5.2 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.5.1 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.5 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.4 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.3.2 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.3.1 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.3 spec/arachni/typhoeus/requrest_spec.rb