-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transition specs fails when using state_machines-activerecord #9
Comments
I'm having problems with this too, with neither |
@KelseyDH I'll try to fix it. Can you show the whole code of the model and your Gemfile. |
I came over this issue as well - so I dug into the gem for two hours and then found the error: I did not define a valid subject. 🙄 Because of that, the specs just created a new instance of my model with just the So when the gem then called: class StateMachinesIntrospector
def valid_transition?(event, to_state)
@subject.send(event) # => false, transition failed because invalid
current_state_value == to_state # => false
end
end So it never passed
I feel you could improve the error messages on this one, since in this case the error is not an invalid transition, but an invalid instance. Hopefully this clear things up! Thanks @vtm9 for the addition, even though I needed a while to appreciate it 😉 |
Having a similar issue... no What can I do to make this error reproducable? |
I started with state_machines, and wrote a few specs about my workflow with state_machines-rspec.
When I decided later to switch to state_machines-activerecord, my transition specs failed, and I can't see why. That kind of spec:
generates that kind of error:
which is weird, considering I have this code in my model:
Is there something I should know about the config of the rspec gem?
(I'm building a Rails 5.1 app)
The text was updated successfully, but these errors were encountered: