diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-07-17 15:36:42 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-07-17 15:36:42 -0700 |
commit | 5737c8e24b022556e5e03629b3249a033c5cee72 (patch) | |
tree | 7a0516ee9beb359f2600d042c523f65b8e969278 | |
parent | 5751b7ea58d7cf259dda30fb42fff51fc6ae93d5 (diff) | |
download | rails-5737c8e24b022556e5e03629b3249a033c5cee72.tar.gz rails-5737c8e24b022556e5e03629b3249a033c5cee72.tar.bz2 rails-5737c8e24b022556e5e03629b3249a033c5cee72.zip |
fix thread safety issues
this test case had a race condition where it could download data
multiple times. We'll download the data once at class load.
-rw-r--r-- | activesupport/test/multibyte_conformance_test.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activesupport/test/multibyte_conformance_test.rb b/activesupport/test/multibyte_conformance_test.rb index 58385c8810..aba81b8248 100644 --- a/activesupport/test/multibyte_conformance_test.rb +++ b/activesupport/test/multibyte_conformance_test.rb @@ -21,6 +21,7 @@ class Downloader end end end + true end end @@ -30,13 +31,15 @@ class MultibyteConformanceTest < ActiveSupport::TestCase UNIDATA_URL = "http://www.unicode.org/Public/#{ActiveSupport::Multibyte::Unicode::UNICODE_VERSION}/ucd" UNIDATA_FILE = '/NormalizationTest.txt' CACHE_DIR = File.join(Dir.tmpdir, 'cache') + FileUtils.mkdir_p(CACHE_DIR) + RUN_P = begin + Downloader.download(UNIDATA_URL + UNIDATA_FILE, CACHE_DIR + UNIDATA_FILE) + rescue + end def setup - FileUtils.mkdir_p(CACHE_DIR) - Downloader.download(UNIDATA_URL + UNIDATA_FILE, CACHE_DIR + UNIDATA_FILE) @proxy = ActiveSupport::Multibyte::Chars - rescue - skip "Unable to download test data" + skip "Unable to download test data" unless RUN_P end def test_normalizations_C |