Forum: RSpec Using Rails observers and testability

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
059ed46172a087063ce26250e44c8627?d=identicon&s=25 Fernando Perez (fernando)
on 2009-05-04 14:33
Hi,

Before I do anything stupid, I'd like to know if there are any gotchas
when using Rails observers instead of writing my own methods or
callbacks? Are they easy to spec/test or will I run into troubles? Are
they easily mockable?
B8c4bfb1b6002a5b43d87de3335401f5?d=identicon&s=25 BJ Clark (Guest)
on 2009-05-04 20:12
(Received via mailing list)
Fernando,

They are easier to spec with Pat Maddox's "no peeping toms" plugin.
http://github.com/pat-maddox/no-peeping-toms/tree/master

BJ Clark
48641c4be1fbe167929fb16c9fd94990?d=identicon&s=25 Mark Wilden (Guest)
on 2009-05-04 20:47
(Received via mailing list)
On Mon, May 4, 2009 at 10:57 AM, BJ Clark <bj@aboutus.org> wrote:

> Fernando,
>
> They are easier to spec with Pat Maddox's "no peeping toms" plugin.
> http://github.com/pat-maddox/no-peeping-toms/tree/master
>

FWIW, I was not able to run specs surrounded by a with_observer call
when
using mislav-will_paginate.

///ark
F86901feca747abbb5c6c020362ef2e7?d=identicon&s=25 Zach Dennis (zdennis)
on 2009-05-04 21:45
(Received via mailing list)
On Mon, May 4, 2009 at 1:57 PM, BJ Clark <bj@aboutus.org> wrote:
> Fernando,
>
> They are easier to spec with Pat Maddox's "no peeping toms" plugin.
> http://github.com/pat-maddox/no-peeping-toms/tree/master

I use Pat's no-peeping-toms plugin as well. It's a great tool in Rails
toolbox.

Brandon Keepers has made some additional enhancements which are nice:

http://github.com/collectiveidea/no-peeping-toms/tree/master

I don't know if he has requested Pat to pull them in, but Pat if
you're listening please check them out and consider pulling them in.
As much as I like the ability to fork there's something to be said
about having a consistent *official* home for plugins. ;)

>> callbacks? Are they easy to spec/test or will I run into troubles? Are
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



--
Zach Dennis
http://www.continuousthinking.com (personal)
http://www.mutuallyhuman.com (hire me)
@zachdennis (twitter)
39100495c9937c39b2e0c704444e1b4a?d=identicon&s=25 Pat Maddox (Guest)
on 2009-05-05 17:03
(Received via mailing list)
On Mon, May 4, 2009 at 12:39 PM, Zach Dennis <zach.dennis@gmail.com>
wrote:
> http://github.com/collectiveidea/no-peeping-toms/tree/master
>
> I don't know if he has requested Pat to pull them in, but Pat if
> you're listening please check them out and consider pulling them in.

Okay, done

Pat
This topic is locked and can not be replied to.