From 4cd2a60747a0decd2f3be31d8839227a2d20bca7 Mon Sep 17 00:00:00 2001 From: Herwin Date: Tue, 9 Jan 2024 18:02:25 +0100 Subject: [PATCH] Expand specs for Thread#thread_variables * Test different key types This shows the Symbol type being used as the internal type. --- core/thread/thread_variables_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/thread/thread_variables_spec.rb b/core/thread/thread_variables_spec.rb index 9d1466d4f..1c4937208 100644 --- a/core/thread/thread_variables_spec.rb +++ b/core/thread/thread_variables_spec.rb @@ -26,4 +26,12 @@ Thread.current.thread_variables.should == [] @t.thread_variables.should == [] end + + it "converts keys into Symbols" do + key = mock('key') + key.should_receive(:to_str).and_return('a') + @t.thread_variable_set(key, 49) + @t.thread_variable_set('b', 50) + @t.thread_variables.sort.should == [:a, :b] + end end