-
Notifications
You must be signed in to change notification settings - Fork 503
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
Problem with parent-child relations in tests #11
Comments
Dennis Theisen commented It is also not possible for me to use anymore, it throws the same kind of exception: @NoMethodError: undefined method `create’ for PluginAWeek::StateMachine::Event:Class@ I am really going crazy over this, I have no clue what I am doing wrong. But it seems, like it’s only me, as I have found no one else having this kind of problem... :( |
Hi soleone, Thanks for reporting the problem. It sounds like #create is getting called from within an event block like so: @@@ ruby Is this a problem you’re still running into or has it since been resolved? |
Dennis Theisen commented Hey Aaron, unfortunately I forgot to update this ticket, because the problem is resolved. There was a namespace clash: in our system we also had an I fixed the problem by changing the Listener in our system from Sorry for wasting your time, I thought I already updated this ticket. Greetings, Dennis |
Dennis Theisen commented Btw, it seems I screwed up the layout because there is an unclosed code-tag. I tried to close it with this post :) |
Thanks for the update. It turns out this actually is a problem which could affect other plugins here as well. I didn’t think about the fact that including PluginAWeek::StateMachine in ActiveRecord would cause all model references to Event/Machine/Transition to point to those classes under the PluginAWeek::StateMachine namespace instead of the top-level namespace. A very interesting problem! A fix for this problem should be available within the next few days or so, at which point you should no longer need to use ::Event instead of Event :) |
(from [a3cbd33]) Change how the base module is included to prevent namespacing conflicts [#1 state:resolved] http://github.com/pluginaweek/state_machine/commit/a3cbd3308f37deb083d277c1b253837e93e3407a |
Dennis Theisen opened this issue
Ok, I have a Blog which has Articles which has Comments (all ActiveRecord).
The StateMachine is used in the comments (for moderation/trash/spam states).
When running the following BlogTest, I get a strange exception (at least for me it’s strange):
@@@ ruby
assert Blog.create(:title => ’hey’)
@@@
This is the exception:
@NoMethodError: undefined method `create’ for PluginAWeek::StateMachine::Event:Class
method log in event.rb at line 31
method send in association_collection.rb at line 259
method method_missing in association_collection.rb at line 259
method with_scope in base.rb at line 1841@
The statemachine isn’t used in the Blog at all, only in comments which is a second class child. I also tried to install the @plugin_test_helper@ (which is only needed for running the StateMachineTests themselves anyway, I guess)
Do you have any tip, what I am doing wrong? Or is this really a bug?
original LH ticket
This ticket has 0 attachment(s).
The text was updated successfully, but these errors were encountered: