"Chris Flipse" <[EMAIL PROTECTED]> writes:
> I dunno ... creating a bunch of joining methods seems to be an awfully
> disjoint way to deal with something that is, admittedly, designed to
> laugh in the face of the Law of Demeter.
>
> I've been handling chains through some heavy use of null_object
Right. Example passed a block, but stub_chains didn't call it. Pretend
there's a yield(hades) in there somewhere.
On Tue, Nov 4, 2008 at 10:26 PM, Chris Flipse <[EMAIL PROTECTED]> wrote:
> I dunno ... creating a bunch of joining methods seems to be an awfully
> disjoint way to deal with somethi
I dunno ... creating a bunch of joining methods seems to be an awfully
disjoint way to deal with something that is, admittedly, designed to laugh
in the face of the Law of Demeter.
I've been handling chains through some heavy use of null_object stubs ...
but, I've been doing that sort of manually.
Fernando Perez <[EMAIL PROTECTED]> writes:
> Therefore a workaround is to define an instance method:
> --
> class Thing
> def self.method1_and_method2(arg)
> method1(arg).method2
> end
> end
I'm inclined to call this an improvement rather than a workaround :)
Pat
Here you go:
It's not easy to test for the following named_scopes:
--
Thing.method1(@current_user).method2.method3 :page =>
params[:page]
--
I tried:
--
Thing.should_receive(:method1)..
Thing.should_receive(:method2)..
Thing.should_receive(:method3)
--
But testing for these three method calls did
On 4 Nov 2008, at 21:48, Fernando Perez wrote:
This trick to spec a named_scope method works very well. And it cleans
up the chain mess in the controller.
Which trick is that?
Sorry if this sounds a bit patronising, but it does help if you quote
the relevant bits of a post you're replying t
This trick to spec a named_scope method works very well. And it cleans
up the chain mess in the controller.
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-user
Very clear.
Thank you very much Pat!
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
On Fri, Sep 12, 2008 at 5:20 AM, Juanma Cervera <[EMAIL PROTECTED]> wrote:
> Hello,
> I am having trouble to mock the chaining of named_scope in the
> controller, also I would like to use will_paginate.
>
> def index
> @things = Thing.allowed_for(@current_user).available.paginate :page =>
> params
Hello,
I am having trouble to mock the chaining of named_scope in the
controller, also I would like to use will_paginate.
def index
@things = Thing.allowed_for(@current_user).available.paginate :page =>
params[:page]
end
¿How to do it?
Thanks
Juanma Cervera
--
Posted via http://www.ruby-forum
10 matches
Mail list logo