active_interaction-extras
active_interaction-extras copied to clipboard
stub_service_delay calls unknown method
When using any of the RSpec helper methods for delayed jobs (allow_to_delay_run
, allow_to_delay_execute
, expect_to_delay_run
, expect_not_to_run_delayed
, expect_to_not_run_delayed
, and expect_to_delay_execute
), a NoMethodError
is thrown because ActiveInteraction::Extras::Rspec
expects the interaction instance to respond to raw_inputs
, but it does not. While there is an instance variable, @_interaction_raw_inputs
, this is marked as private. Maybe we could inputs
?
# Before
opts[:execute] ||= proc do |instance|
# call original queueing logic, so the argument serialisation is triggered
delayed_run.run(instance.raw_inputs)
end
# After
opts[:execute] ||= proc do |instance|
# call original queueing logic, so the argument serialisation is triggered
delayed_run.run(**instance.inputs.to_h)
end
Personally I don't like the current implementation of Rspec helpers and would like to rewrite them. Contributions are welcomed.