summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorVladimir Kochnev <[email protected]>2019-03-09 19:49:27 +0300
committerVladimir Kochnev <[email protected]>2019-10-02 18:06:39 +0300
commit09469669ccadf8580643eae8352372e92e1ddbb0 (patch)
tree35514f7979ee3abcbadbb416710c0577b47c924a /test
parent913003eaf0456e4645cad91f2622354deae10841 (diff)
downloadcaxlsx-09469669ccadf8580643eae8352372e92e1ddbb0.tar.gz
caxlsx-09469669ccadf8580643eae8352372e92e1ddbb0.zip
Cache relationship in Hash rather than in Array.
Also cacle only ids, not entire instances.
Diffstat (limited to 'test')
-rw-r--r--test/rels/tc_relationship.rb6
-rw-r--r--test/tc_package.rb4
2 files changed, 5 insertions, 5 deletions
diff --git a/test/rels/tc_relationship.rb b/test/rels/tc_relationship.rb
index 845f789e..f47b6a4d 100644
--- a/test/rels/tc_relationship.rb
+++ b/test/rels/tc_relationship.rb
@@ -14,10 +14,10 @@ class TestRelationships < Test::Unit::TestCase
assert_equal instance.Id, Axlsx::Relationship.new(source_obj, Axlsx::WORKSHEET_R, 'target').Id
end
- def test_instances_cache_is_thread_safe
+ def test_ids_cache_is_thread_safe
cache1, cache2 = nil
- t1 = Thread.new { cache1 = Axlsx::Relationship.instances }
- t2 = Thread.new { cache2 = Axlsx::Relationship.instances }
+ t1 = Thread.new { cache1 = Axlsx::Relationship.ids_cache }
+ t2 = Thread.new { cache2 = Axlsx::Relationship.ids_cache }
[t1, t2].each(&:join)
assert_not_same(cache1, cache2)
end
diff --git a/test/tc_package.rb b/test/tc_package.rb
index 4bd0d429..1e5ce322 100644
--- a/test/tc_package.rb
+++ b/test/tc_package.rb
@@ -236,8 +236,8 @@ class TestPackage < Test::Unit::TestCase
# this is just a roundabout guess for a package as it is build now
# in testing.
assert(stream.size > 80000)
- # Cached instances should be cleared
- assert(Axlsx::Relationship.instances.empty?)
+ # Cached ids should be cleared
+ assert(Axlsx::Relationship.ids_cache.empty?)
end
def test_encrypt