Sha256: afbd7f35edd5863ef32d50b0df5a211c632eebc576c9a9f1deb8dfccb625691c

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../helper')

describe Iconoclasm::Downloader do

  before do
    class Thing; include Iconoclasm::Downloader; end
    @thing  = Thing.new
    @url    = 'http://www.website.com'
    @curl   = mock('curl')
  end
  
  describe "GETting a url" do
    it "should GET the url using Typheous" do
      Typhoeus::Request.expects(:get).with(@url, instance_of(Hash))
      @thing.get(@url)
    end
    
    it "should set the user agent to the default user agent" do
      Typhoeus::Request.expects(:get).with(instance_of(String), has_entry(:user_agent => Iconoclasm::Downloader.user_agent))
      @thing.get(@url)
    end
    
    it "should follow redirects" do
      Typhoeus::Request.expects(:get).with(instance_of(String), has_entry(:follow_location => true))
      @thing.get(@url)
    end
  end
  
  describe "HEADing a url" do
    it "should HEAD the url using Typhoeus" do
      Typhoeus::Request.expects(:head).with(@url, instance_of(Hash))
      @thing.head(@url)
    end
    
    it "should set the user agent to the default user agent" do
      Typhoeus::Request.expects(:head).with(instance_of(String), has_entry(:user_agent => Iconoclasm::Downloader.user_agent))
      @thing.head(@url)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
iconoclasm-1.0.7 spec/iconoclasm/downloader_spec.rb
iconoclasm-1.0.6 spec/iconoclasm/downloader_spec.rb
iconoclasm-1.0.5 spec/iconoclasm/downloader_spec.rb
iconoclasm-1.0.4 spec/iconoclasm/downloader_spec.rb
iconoclasm-1.0.3 spec/iconoclasm/downloader_spec.rb
iconoclasm-1.0.2 spec/iconoclasm/downloader_spec.rb
iconoclasm-1.0.1 spec/iconoclasm/downloader_spec.rb