Clean up downloader test a bit

This commit is contained in:
Fabio Rehm 2013-07-28 20:08:53 -03:00
parent c7aed1a6a1
commit bf4131af17
1 changed files with 4 additions and 4 deletions

View File

@ -21,12 +21,14 @@ describe Vagrant::Util::Downloader do
end end
describe "#download!" do describe "#download!" do
let(:curl_options) {
["--fail", "--location", "--max-redirs", "10", "--user-agent", described_class::USER_AGENT, "--output", destination, source, {}]
}
context "with a good exit status" do context "with a good exit status" do
let(:exit_code) { 0 } let(:exit_code) { 0 }
it "downloads the file and returns true" do it "downloads the file and returns true" do
curl_options = ["--fail", "--location", "--max-redirs", "10", "--user-agent", described_class::USER_AGENT, "--output", destination, source, {}]
Vagrant::Util::Subprocess.should_receive(:execute). Vagrant::Util::Subprocess.should_receive(:execute).
with("curl", *curl_options). with("curl", *curl_options).
and_return(subprocess_result) and_return(subprocess_result)
@ -39,8 +41,6 @@ describe Vagrant::Util::Downloader do
let(:exit_code) { 1 } let(:exit_code) { 1 }
it "raises an exception" do it "raises an exception" do
curl_options = ["--fail", "--location", "--max-redirs", "10", "--user-agent", described_class::USER_AGENT, "--output", destination, source, {}]
Vagrant::Util::Subprocess.should_receive(:execute). Vagrant::Util::Subprocess.should_receive(:execute).
with("curl", *curl_options). with("curl", *curl_options).
and_return(subprocess_result) and_return(subprocess_result)