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.
Fernando P. (Guest)
on 2009-05-04 16: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?
BJ Clark (Guest)
on 2009-05-04 22:12
(Received via mailing list)
Fernando,

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

BJ Clark
Mark W. (Guest)
on 2009-05-04 22:47
(Received via mailing list)
On Mon, May 4, 2009 at 10:57 AM, BJ Clark <removed_email_address@domain.invalid> 
wrote:

> Fernando,
>
> They are easier to spec with Pat M.'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
Zach D. (Guest)
on 2009-05-04 23:45
(Received via mailing list)
On Mon, May 4, 2009 at 1:57 PM, BJ Clark <removed_email_address@domain.invalid> 
wrote:
> Fernando,
>
> They are easier to spec with Pat M.'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 K. 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
> removed_email_address@domain.invalid
> http://rubyforge.org/mailman/listinfo/rspec-users
>



--
Zach D.
http://www.continuousthinking.com (personal)
http://www.mutuallyhuman.com (hire me)
@zachdennis (twitter)
Pat M. (Guest)
on 2009-05-05 19:03
(Received via mailing list)
On Mon, May 4, 2009 at 12:39 PM, Zach D. <removed_email_address@domain.invalid>
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.