active_interaction-extras icon indicating copy to clipboard operation
active_interaction-extras copied to clipboard

stub_service_delay calls unknown method

Open HashNotAdam opened this issue 1 year ago • 1 comments

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

HashNotAdam avatar Oct 30 '23 03:10 HashNotAdam

Personally I don't like the current implementation of Rspec helpers and would like to rewrite them. Contributions are welcomed.

antulik avatar Nov 15 '23 02:11 antulik