Sha256: 1c15b8fd16833467adfa2182f11810031a1750db7a9701ae3b911598c551e6d8

Contents?: true

Size: 1.47 KB

Versions: 4

Compression:

Stored size: 1.47 KB

Contents

require_relative '../../spec_helper'

describe Typhoeus::Request do

    describe '#id' do
        it 'should be 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 'allow 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 'set 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 'should set 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 'should set 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

4 entries across 4 versions & 1 rubygems

Version Path
arachni-0.4.1.3 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.1.2 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.1.1 spec/arachni/typhoeus/requrest_spec.rb
arachni-0.4.1 spec/arachni/typhoeus/requrest_spec.rb