-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Right now the generated spec/support/operations.rb file (from #23) is:
require "dry/monads"
RSpec.configure do |config|
# Provide `Success` and `Failure` for testing operation results
config.include Dry::Monads[:result]
endBut now with the Dry::Monad's RSpec extension (PR: dry-rb/dry-monads#183) we don't need to do that anymore. Instead, we can just do Dry::Monads.load_extensions(:rspec). This also has a huge advantage of allowing expect(result).to be_a(Success) whereas before you could only specify a specific Success object, e.g. Success(123). See: dry-rb/dry-monads#182 for more on that issue.
So now, based on my testing, we can update that file to just:
Dry::Monads.load_extensions(:rspec)
However, it seems like overkill to create a file for just 1 line. In the name of pragmatism, I'd just include that directly in spec/spec_helper.rb. Or, ideally, we could change dry-monads behavior to automatically load the :rspec extension when it's bundled with rspec. What are your thoughts on doing that @flash-gordon? cc @timriley