Sha256: e87fd5f014562dc3f795cc851effbeabe935ecd97820335bf9bc7b984602041b
Contents?: true
Size: 1.05 KB
Versions: 16
Compression:
Stored size: 1.05 KB
Contents
require 'dply/curl' module Dply describe Curl do let(:url) { "http://127.0.0.1:8000/build.tar.gz" } describe "#download(url, file)" do it "downloads the url to file" do Dir.mktmpdir do |dir| f = "#{dir}/f" curl = Curl.new expect(Logger.logger).to receive(:bullet).with("downloading #{url}") curl.download(url, f) expect(File).to exist(f) end end it "raises error when url doesn't exist" do url = "http://127.0.0.1:8000/build" Dir.mktmpdir do |dir| f = "#{dir}/f" curl = Curl.new expect(Logger.logger).to receive(:bullet).with("downloading #{url}") expect { curl.download(url, f) }.to raise_error(Error) end end it "logs message to debug when quiet: true" do Dir.mktmpdir do |dir| f = "#{dir}/f" curl = Curl.new(quiet: true) expect(Logger.logger).to receive(:debug).with("downloading #{url}") curl.download(url, f) end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems