From 2c297abea0d8a398d1884a241daf7e19c6b85fab Mon Sep 17 00:00:00 2001 From: Ryan Buckley Date: Tue, 26 Mar 2024 10:32:14 -0700 Subject: [PATCH 1/3] Fix bug with marshalling experiments --- lib/scientist/experiment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scientist/experiment.rb b/lib/scientist/experiment.rb index 7512c0b..591b3a0 100644 --- a/lib/scientist/experiment.rb +++ b/lib/scientist/experiment.rb @@ -345,7 +345,7 @@ def marshal_dump [@name, @result, @raise_on_mismatches] end - def marshal_load + def marshal_load(array) @name, @result, @raise_on_mismatches = array end end From b98d3f8ae36d3ecf257a0fea8a2b11d5d4feb747 Mon Sep 17 00:00:00 2001 From: Ryan Buckley Date: Tue, 26 Mar 2024 10:39:48 -0700 Subject: [PATCH 2/3] Add test for marshal load --- test/scientist/experiment_test.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/scientist/experiment_test.rb b/test/scientist/experiment_test.rb index 1452d9c..558a239 100644 --- a/test/scientist/experiment_test.rb +++ b/test/scientist/experiment_test.rb @@ -512,6 +512,10 @@ def @ex.raised(op, exception) assert_kind_of(String, Marshal.dump(mismatch)) end + it "can be marshal loaded" do + assert_kind_of(Fake, Marshal.load(Marshal.dump(@ex)) + end + describe "#raise_on_mismatches?" do it "raises when there is a mismatch if the experiment instance's raise on mismatches is enabled" do Fake.raise_on_mismatches = false From 2c4c6e929be2a1619d329e8b3bf8cda4c84cad07 Mon Sep 17 00:00:00 2001 From: Ryan Buckley Date: Tue, 26 Mar 2024 10:42:20 -0700 Subject: [PATCH 3/3] Fix syntax error --- test/scientist/experiment_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/scientist/experiment_test.rb b/test/scientist/experiment_test.rb index 558a239..e155043 100644 --- a/test/scientist/experiment_test.rb +++ b/test/scientist/experiment_test.rb @@ -513,7 +513,7 @@ def @ex.raised(op, exception) end it "can be marshal loaded" do - assert_kind_of(Fake, Marshal.load(Marshal.dump(@ex)) + assert_kind_of(Fake, Marshal.load(Marshal.dump(@ex))) end describe "#raise_on_mismatches?" do