You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can't pass an empty hash as callback parameters to transition_from since 5.5.0
To Reproduce
Reproduce script is here.
# frozen_string_literal: true# bug_report_aasm.rb require"bundler/inline"gemfile(true)dosource"https://rubygems.org"gem"aasm","5.5.0"gem"rspec"endclassJobincludeAASMaasmdostate:sleeping,initial: truestate:running,:cleaningevent:rundotransitionsfrom: :sleeping,to: :running,after: :prepare_run!endevent:cleandotransitionsfrom: :running,to: :cleaningendenddefprepare_run!(params)putsparamsendendrequire"aasm/rspec"require"rspec/autorun"RSpec.describeJobdoit"move to 'run' with parameters"dojob=Job.newexpect(job).totransition_from(:sleeping).to(:running).on_event(:run,{})endend
$ ruby bug_report_aasm.rb
F
Failures:
1) Job move to 'run' with parameters
Failure/Error:
def prepare_run!(params)
puts params
end
ArgumentError:
wrong number of arguments (given 0, expected 1)
# bug_report_aasm.rb:28:in `prepare_run!'# bug_report_aasm.rb:39:in `block (2 levels) in <main>'
Finished in 0.00177 seconds (files took 0.05501 seconds to load)
1 example, 1 failure
Failed examples:
rspec bug_report_aasm.rb:37 # Job move to 'run' with parameters
Expected behavior
Allow to pass an empty hash as callback parameters via transition_from
the after: :prepare_run! isnt passing anything. You'd have to do something like after: proc { prepare_run!({thing: other})
or you could default the def prepare_run!(params = {})
Describe the bug
Can't pass an empty hash as callback parameters to
transition_from
since 5.5.0To Reproduce
Reproduce script is here.
Expected behavior
Allow to pass an empty hash as callback parameters via
transition_from
Additional context
This has happened since #808.
The text was updated successfully, but these errors were encountered: