This looks similar to issue 52: #52
Basically, if I am touching an observer (a singleton) in one test, it seems to affect another test. Example:
it "acts on the after_create notification" do
thing = FactoryGirl.build(:thing)
FeedObserver.any_instance.should_receive(:after_create) #or FeedObserver.instance.should_receive(:after_create)
it "creates a LogEvent" do
obs = FeedObserver.instance
}.to change(TimelineEvent, :count).by(1)
In the second test FeedObserver.instance returns a mocked object
@travisp Observers in Rails are "singletons" - FeedObserver.instance will always return the same instance. No need to use any_instance here. I tried mocking FeedObserver.instance and could not duplicate your error.
@kaiwren I did duplicate his code and got a SystemStackError on master. I'm sure there is a conflict between how observers are implemented and any_instance.
@justinko Noted. I'll look into this.
@alindeman -- you pushed some fixes to any_instance a bit ago--do you think it fixed this issue? (I forget now what issues you fixed exactly).
I believe a727464 should have fixed the SystemStackError portion, yes :)