test/unit/vagrant/util/downloader_test.rb in vagrant-unbundled-1.9.7.1 vs test/unit/vagrant/util/downloader_test.rb in vagrant-unbundled-1.9.8.1

- old
+ new

@@ -7,12 +7,12 @@ let(:destination) { "bar" } let(:exit_code) { 0 } let(:subprocess_result) do double("subprocess_result").tap do |result| - result.stub(exit_code: exit_code) - result.stub(stderr: "") + allow(result).to receive(:exit_code).and_return(exit_code) + allow(result).to receive(:stderr).and_return("") end end subject { described_class.new(source, destination) } @@ -67,11 +67,11 @@ expect(Vagrant::Util::Subprocess).to receive(:execute). with("curl", *curl_options). and_return(subprocess_result) - expect(subject.download!).to be_true + expect(subject.download!).to be(true) end end context "with an urlescaped username and password" do it "downloads the file with unescaped credentials" do @@ -88,11 +88,11 @@ expect(Vagrant::Util::Subprocess).to receive(:execute). with("curl", *curl_options). and_return(subprocess_result) - expect(subject.download!).to be_true + expect(subject.download!).to be(true) end end context "with checksum" do let(:checksum_expected_value){ 'MD5_CHECKSUM_VALUE' } @@ -114,11 +114,11 @@ expect(klass).to receive(:new).and_return(digest) expect(digest).to receive(:hexdigest).and_return(checksum_expected_value) end it "should not raise an exception" do - expect(subject.download!).to be_true + expect(subject.download!).to be(true) end end context "that does not match expected value" do before do @@ -142,11 +142,11 @@ expect(Digest::SHA1).to receive(:new).and_return(digest) expect(digest).to receive(:hexdigest).and_return(checksum_expected_value).exactly(2).times end it "should not raise an exception" do - expect(subject.download!).to be_true + expect(subject.download!).to be(true) end end context "that only sha1 matches expected value" do subject { described_class.new(source, destination, md5: checksum_invalid_value, sha1: checksum_expected_value) } @@ -197,10 +197,10 @@ let(:curl_options) { ["-q", "--fail", "--location", "--max-redirs", "10", "--user-agent", described_class::USER_AGENT, source, {}] } it "returns the output" do - subprocess_result.stub(stdout: "foo") + allow(subprocess_result).to receive(:stdout).and_return("foo") options = curl_options.dup options.unshift("-I") expect(Vagrant::Util::Subprocess).to receive(:execute).