Commit a40f4aa Krzysztof Wrzalik
committed
1 parent b854626 commit a40f4aa Copy full SHA for a40f4aa
File tree 1 file changed +3
-0
lines changed
1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ class Param2 < T::Struct
159
159
T . assert_type! ( TypeCoerce [ Integer ] . new . from ( 1 ) , Integer )
160
160
T . assert_type! ( TypeCoerce [ Integer ] . new . from ( '1.0' ) , Integer )
161
161
T . assert_type! ( TypeCoerce [ T . nilable ( Integer ) ] . new . from ( nil ) , T . nilable ( Integer ) )
162
+ T . assert_type! ( TypeCoerce [ BigDecimal ] . new . from ( '1.0' ) , BigDecimal )
162
163
end
163
164
164
165
it 'coreces correctly' do
@@ -176,6 +177,8 @@ class Param2 < T::Struct
176
177
expect ( TypeCoerce [ T . nilable ( Integer ) ] . new . from ( '' ) ) . to be nil
177
178
expect { TypeCoerce [ T . nilable ( Integer ) ] . new . from ( [ ] ) } . to raise_error ( TypeCoerce ::CoercionError )
178
179
expect ( TypeCoerce [ T . nilable ( String ) ] . new . from ( '' ) ) . to eql ''
180
+
181
+ expect ( TypeCoerce [ BigDecimal ] . new . from ( 123.321 ) ) . to eql BigDecimal ( 123.321 , 0 )
179
182
end
180
183
end
181
184
You can’t perform that action at this time.
0 commit comments