summaryrefslogtreecommitdiffhomepage
path: root/test/rels/tc_relationship.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rels/tc_relationship.rb')
-rw-r--r--test/rels/tc_relationship.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/rels/tc_relationship.rb b/test/rels/tc_relationship.rb
index add1654f..845f789e 100644
--- a/test/rels/tc_relationship.rb
+++ b/test/rels/tc_relationship.rb
@@ -13,6 +13,14 @@ class TestRelationships < Test::Unit::TestCase
instance = Axlsx::Relationship.new(source_obj, Axlsx::WORKSHEET_R, 'target')
assert_equal instance.Id, Axlsx::Relationship.new(source_obj, Axlsx::WORKSHEET_R, 'target').Id
end
+
+ def test_instances_cache_is_thread_safe
+ cache1, cache2 = nil
+ t1 = Thread.new { cache1 = Axlsx::Relationship.instances }
+ t2 = Thread.new { cache2 = Axlsx::Relationship.instances }
+ [t1, t2].each(&:join)
+ assert_not_same(cache1, cache2)
+ end
def test_target_is_only_considered_for_same_attributes_check_if_target_mode_is_external
source_obj = Object.new