mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
5751b7ea58
commit
5737c8e24b
1 changed files with 7 additions and 4 deletions
|
@ -21,6 +21,7 @@ class Downloader
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -30,13 +31,15 @@ class MultibyteConformanceTest < ActiveSupport::TestCase
|
||||||
UNIDATA_URL = "http://www.unicode.org/Public/#{ActiveSupport::Multibyte::Unicode::UNICODE_VERSION}/ucd"
|
UNIDATA_URL = "http://www.unicode.org/Public/#{ActiveSupport::Multibyte::Unicode::UNICODE_VERSION}/ucd"
|
||||||
UNIDATA_FILE = '/NormalizationTest.txt'
|
UNIDATA_FILE = '/NormalizationTest.txt'
|
||||||
CACHE_DIR = File.join(Dir.tmpdir, 'cache')
|
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
|
def setup
|
||||||
FileUtils.mkdir_p(CACHE_DIR)
|
|
||||||
Downloader.download(UNIDATA_URL + UNIDATA_FILE, CACHE_DIR + UNIDATA_FILE)
|
|
||||||
@proxy = ActiveSupport::Multibyte::Chars
|
@proxy = ActiveSupport::Multibyte::Chars
|
||||||
rescue
|
skip "Unable to download test data" unless RUN_P
|
||||||
skip "Unable to download test data"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_normalizations_C
|
def test_normalizations_C
|
||||||
|
|
Loading…
Reference in a new issue