diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-27 13:06:04 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-27 13:06:04 -0800 |
commit | 5aade8245a0fe10e80e60fd0d01427406b53e753 (patch) | |
tree | 19d48fbede8e5f468f23bed4170d35cb8e87bfb6 /actionpack/test | |
parent | 6c0ea8875fa888f1f20b31e9ef67b73966078b14 (diff) | |
parent | 8b104e2f0cb6e92604185f7a4934acad80142f2a (diff) | |
download | rails-5aade8245a0fe10e80e60fd0d01427406b53e753.tar.gz rails-5aade8245a0fe10e80e60fd0d01427406b53e753.tar.bz2 rails-5aade8245a0fe10e80e60fd0d01427406b53e753.zip |
Merge pull request #8318 from Empact/fixture-file
Use File.join to better integrate fixture_path in fixture_file_upload.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/test_case_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index 8990fc34d6..bdca1d4d77 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -818,6 +818,18 @@ XML assert_equal '159528', @response.body end + def test_fixture_file_upload_relative_to_fixture_path + TestCaseTest.stubs(:fixture_path).returns(FILES_DIR) + uploaded_file = fixture_file_upload("mona_lisa.jpg", "image/jpg") + assert_equal File.open("#{FILES_DIR}/mona_lisa.jpg", READ_PLAIN).read, uploaded_file.read + end + + def test_fixture_file_upload_ignores_nil_fixture_path + TestCaseTest.stubs(:fixture_path).returns(nil) + uploaded_file = fixture_file_upload("#{FILES_DIR}/mona_lisa.jpg", "image/jpg") + assert_equal File.open("#{FILES_DIR}/mona_lisa.jpg", READ_PLAIN).read, uploaded_file.read + end + def test_action_dispatch_uploaded_file_upload filename = 'mona_lisa.jpg' path = "#{FILES_DIR}/#{filename}" |