Sha256: 2cb1422c19e8ce95770499c8586a8c0afc54b6dabb19cbee486aa6516fbc02b6

Contents?: true

Size: 1.13 KB

Versions: 30

Compression:

Stored size: 1.13 KB

Contents

require File.join(File.dirname(File.expand_path(__FILE__)), "/../spec_helper.rb")

describe "AutomateIt::DownloadManager" do
  before :all do
    @a = AutomateIt.new(:verbosity => Logger::WARN)
  end

  it "should download a web page to a file" do
    @a.mktempdircd do
      source = "http://www.google.com/"
      target = "google.html"

      @a.download(source, :to => target).should be_true

      File.exists?(target).should be_true
      File.read(target).should =~ /<html>.*Google/im
    end
  end

  it "should download a web page to a directory" do
    @a.mktempdircd do
      source = "http://www.google.com/"
      intermediate = "."
      target = "www.google.com"

      @a.download(source, :to => intermediate).should be_true

      File.exists?(target).should be_true
      File.read(target).should =~ /<html>.*Google/im
    end
  end

  it "should download a web page to current directory" do
    @a.mktempdircd do
      source = "http://www.google.com/"
      target = "www.google.com"

      @a.download(source).should be_true

      File.exists?(target).should be_true
      File.read(target).should =~ /<html>.*Google/im
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
automate-it-0.9.2 spec/integration/download_spec.rb
automate-it-0.9.1 spec/integration/download_spec.rb
automate-it-0.9.0 spec/integration/download_spec.rb
automateit-0.70930 spec/integration/download_spec.rb
automateit-0.71003 spec/integration/download_spec.rb
automateit-0.70928 spec/integration/download_spec.rb
automateit-0.71021 spec/integration/download_spec.rb
automateit-0.71031.2 spec/integration/download_spec.rb
automateit-0.71006 spec/integration/download_spec.rb
automateit-0.71030 spec/integration/download_spec.rb
automateit-0.71017 spec/integration/download_spec.rb
automateit-0.71012 spec/integration/download_spec.rb
automateit-0.71031.1 spec/integration/download_spec.rb
automateit-0.71101.1 spec/integration/download_spec.rb
automateit-0.71031 spec/integration/download_spec.rb
automateit-0.71103 spec/integration/download_spec.rb
automateit-0.71101 spec/integration/download_spec.rb
automateit-0.71102 spec/integration/download_spec.rb
automateit-0.71101.2 spec/integration/download_spec.rb
automateit-0.71112 spec/integration/download_spec.rb