README.md in sorbet-result-1.1.0 vs README.md in sorbet-result-1.2.0
- old
+ new
@@ -76,12 +76,12 @@
```ruby
result = call_api(1)
result.success? # => true on success, false on failure
result.failure? # => true on failure, false on success
-result.payload # => nil on failure, payload type on failure
-result.error # => nil on success, error type on failure
+result.payload # => raises error on failure, payload type on success
+result.error # => raises error on success, error type on failure
result.payload_or("fallback") # => returns payload on success, given value on failure
# You can combine all the above to write flow-sensitive type-checked code
if result.success?
T.assert_type!(result.payload, Float)
@@ -132,10 +132,10 @@
We ship with a few Minitest assertions that can be used to easily verify Results.
```ruby
# test_helper.rb
-require "minitest/results_assertions"
+require "minitest/result_assertions"
# You also need add this to `sorbet/tapioca/require.rb` and rebuild the Minitest gem RBIs
# *_test.rb
@success = Typed::Success.new("Test Payload")