From e4fcc58529c9659b5d0d35479a9a6acf8edb9e36 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sat, 24 Sep 2016 08:56:31 +0930 Subject: Only search fixture_path for files that can't be found directly When passed an already-valid file name, prepending the path is likely to create problems. This is particularly relevant for #26384, which adds fixture_path handling to test classes that previously didn't have it: any existing caller must have been manually locating the file, and we don't want to break them. --- actionpack/lib/action_dispatch/testing/test_process.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/testing/test_process.rb') diff --git a/actionpack/lib/action_dispatch/testing/test_process.rb b/actionpack/lib/action_dispatch/testing/test_process.rb index 1456a0afcf..8b03b776fa 100644 --- a/actionpack/lib/action_dispatch/testing/test_process.rb +++ b/actionpack/lib/action_dispatch/testing/test_process.rb @@ -34,7 +34,8 @@ module ActionDispatch # # post :change_avatar, avatar: fixture_file_upload('files/spongebob.png', 'image/png', :binary) def fixture_file_upload(path, mime_type = nil, binary = false) - if self.class.respond_to?(:fixture_path) && self.class.fixture_path + if self.class.respond_to?(:fixture_path) && self.class.fixture_path && + !File.exist?(path) path = File.join(self.class.fixture_path, path) end Rack::Test::UploadedFile.new(path, mime_type, binary) -- cgit v1.2.3