Make VCR disallow unexpected HTTP requests.

This makes it so that tests fail when they make HTTP requests they
aren't expected to. Update these tests so that they use VCR like they
should.
This commit is contained in:
evazion
2014-09-27 00:28:53 -05:00
parent ec0f226f46
commit 268f79c3d9
3 changed files with 30 additions and 15 deletions

View File

@@ -104,10 +104,13 @@ class UploadTest < ActiveSupport::TestCase
should "initialize the final path after downloading a file" do
@upload = FactoryGirl.create(:source_upload)
path = "#{Rails.root}/tmp/test.download.jpg"
assert_nothing_raised {@upload.download_from_source(path)}
assert(File.exists?(path))
assert_equal(8558, File.size(path))
assert_equal(path, @upload.file_path)
VCR.use_cassette("upload-test-file", :record => :once) do
assert_nothing_raised {@upload.download_from_source(path)}
assert(File.exists?(path))
assert_equal(8558, File.size(path))
assert_equal(path, @upload.file_path)
end
end
end