-
Notifications
You must be signed in to change notification settings - Fork 121
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
Can't disable observers #73
Comments
Can you try to debug to see if the |
I've forked the project and I'm digging into it now. But I'm used to being able run these commands
and expect it to work. But
But, using rails command line to debug a bit I get this (Rails 5.0.2)
(you can use #send(:method_name) to access a protected/private method)
Then I disable all observers
But
and
and
So it looks like the problem is in |
How about |
Sorry for not replying earlier. I've been away for a few days. With
I get
But with
I get
Horray!! A result. However when the code is running for real, it obviously doesn't check the product observer instance in the right place. Otherwise it wouldn't be running the code in the observers when they've been disabled. I see that there are two methods #disabled_for? maybe the wrong one gets called. I also notice that
Is always
|
How do I run the test suite? I'm expecting to be able to type
And it will just work. But it isn't. |
Ok, I've progressed to the next error. I had to reinstall bundler. No when I type
(newlines added by me to make it easier to read) But if I create a new Rails 5 project, it defaults to sqlite3 and runs first time without a problem. So I do have sqlite3 installed. If I pause the tests right after it's created the new Rails project, and look for the Rails project then database.yml contains this
As I expect it to, and the gemspec contains this
So I can't see why it's complaining about the sqlite3 gem being missing, unless the test rails application isn't loading the gem in development mode. But I see that the line that creates the temporary Rails app
Skips the gemfile, which is obviously why I'm getting the error
So how can you ever have got the tests to run? |
Ahh!!! I think I've worked it out. Single Table Inheritance is not respected when disabling observers. I have class PhysicalProduct < Product The observer is
but
So the callbacks in My workaround is to rename
I would write a failing test, fix the code to make the test pass, and send in a PR but I can't get the test suite to run. |
That sounds about right. If you can please send the PR. |
I'm seeing this too, now. @JohnSmall still working on this? |
I'm going mad.
In most of my Rspec specs I want observers to be disabled, except for some. But
is not working.
It goes through the motions, something happens, I can see all the observers in the disabled_observers array but the observers still trigger.
It's driving me nuts. However I can see that the gem tests for disable are passing. It must be that the tests are not testing real things
The text was updated successfully, but these errors were encountered: