From 8bf975342fd899b8677515eceea0bb9b580e82fb Mon Sep 17 00:00:00 2001 From: Alex Kalderimis Date: Mon, 22 Jul 2024 19:33:19 -0400 Subject: [PATCH] Update try_spec.rb to test deconstruction --- spec/unit/try_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/unit/try_spec.rb b/spec/unit/try_spec.rb index 2ac671d..2c37c58 100644 --- a/spec/unit/try_spec.rb +++ b/spec/unit/try_spec.rb @@ -57,6 +57,10 @@ it { is_expected.to eql(described_class.new([ZeroDivisionError], "foo")) } it { is_expected.not_to eql(error[division_error]) } + it "deconstructs to the value" do + expect(subject.deconstruct).to eq ["foo"] + end + it "dumps to string" do expect(subject.to_s).to eql('Try::Value("foo")') expect(value[[], unit].to_s).to eql("Try::Value()") @@ -210,6 +214,10 @@ let(:upcase_value) { described_class.new([ZeroDivisionError], "FOO") } let(:upcase_error) { try::Error.new(division_error) } + it "deconstructs to the exception" do + expect(subject.deconstruct).to eq [division_error] + end + describe ".call" do it "is an alias for new" do expect(try::Error.(division_error)).to eql(subject)