[rspec-users] Observer not calling inside a spec

Mikel Lindsaar raasdnil at gmail.com
Wed Nov 26 06:10:32 EST 2008


On Wed, Nov 26, 2008 at 9:41 PM, David Chelimsky <dchelimsky at gmail.com>wrote:

> On Wed, Nov 26, 2008 at 4:32 AM, Mikel Lindsaar <raasdnil at gmail.com>
> wrote:
> > Sorry David, stupid typo.  I am duplicating the text from another screen
> > that is not on the 'net directly.  The second spec does not exist.
>

You are right... doesn't make a lick of difference :)

Although, the new gem builds and installs nicely :)

Any other ideas? Or things you want me to try?

It feels like the observer is not getting instantiated within the Person
class with the spec.  Calling the debugger and putting it inside the
Observer class and then running the spec from the command line with
ruby-debug enabled confirms this as the spec never drops into the debugger
CLI.

Am I missing a load path somewhere?

Putting the debugger within the specification itself and then calling
ActiveRecord::Base.observers returns [:person_observer, .... (other
observers)]

And the following:

(rdb:1) ActiveRecord::Base.observers
[:person_observer, .... (other observers)]
(rdb:1) Person.observers
[]
(rdb:1) Person.add_observer(PersonObserver)
[#<PersonObserver:0x2322234>, PersonObserver]
(rdb:1) Person.observers
[]

So that lead me to try instantiating the observers in the spec with
Person.instantiate_observers.... no joy.

Feeling thoroughly clueless at this point.

-- 
http://lindsaar.net/
Rails, RSpec and Life blog....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081126/3f76dd42/attachment.html>


More information about the rspec-users mailing list