Re: [rspec-users] Controller spec: testing that scope is set

2009-05-21 Thread Michael Schuerig
On Sunday 19 April 2009, Michael Schuerig wrote: > In a Rails controller I set the scope on a model class in an around > filter. I have defined expectations on the model classes, and > ideally, I would add a further expectation for the scope. Is this > already possible in some way? How would I go a

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-21 Thread Zach Dennis
On Tue, Apr 21, 2009 at 4:02 AM, Michael Schuerig wrote: > On Monday 20 April 2009, Zach Dennis wrote: >> > I don't agress. Both classes have distinct, although related >> > purposes. RequestCondition implements the translation from request >> > parameters to #find-options. QueryScope(Builder) fit

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-21 Thread Michael Schuerig
On Monday 20 April 2009, Zach Dennis wrote: > > I don't agress. Both classes have distinct, although related > > purposes. RequestCondition implements the translation from request > > parameters to #find-options. QueryScope(Builder) fits it in with > > ActionController and adds syntactic sugar. The

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-20 Thread Zach Dennis
On Mon, Apr 20, 2009 at 1:35 PM, Zach Dennis wrote: > On Sun, Apr 19, 2009 at 6:41 PM, Michael Schuerig wrote: >> On Sunday 19 April 2009, Zach Dennis wrote: >>> On Sun, Apr 19, 2009 at 2:09 PM, Michael Schuerig >> wrote: >>> > On Sunday 19 April 2009, Zach Dennis wrote: >>> >> On Sun, Apr 19, 2

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-20 Thread Zach Dennis
On Mon, Apr 20, 2009 at 3:27 PM, Michael Schuerig wrote: > On Monday 20 April 2009, Zach Dennis wrote: >> On Sun, Apr 19, 2009 at 6:41 PM, Michael Schuerig > wrote: > [big snip] > >> I think I am starting to understand what you're after. You want to >> ensure the scope defined in your query_scope

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-20 Thread Pat Maddox
On Mon, Apr 20, 2009 at 1:26 PM, Michael Schuerig wrote: > On Monday 20 April 2009, Pat Maddox wrote: >> In a functional test, create some records that will be in the scope >> and some that will be out of the scope, hit the page and make sure >> you only see the ones that you want.  I would either

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-20 Thread Michael Schuerig
On Monday 20 April 2009, Pat Maddox wrote: > In a functional test, create some records that will be in the scope > and some that will be out of the scope, hit the page and make sure > you only see the ones that you want. I would either do this with > cucumber, or write a controller spec and verify

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-20 Thread Pat Maddox
In a functional test, create some records that will be in the scope and some that will be out of the scope, hit the page and make sure you only see the ones that you want. I would either do this with cucumber, or write a controller spec and verify that only certain records show in the the assigns

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-20 Thread Michael Schuerig
On Monday 20 April 2009, Zach Dennis wrote: > On Sun, Apr 19, 2009 at 6:41 PM, Michael Schuerig wrote: [big snip] > I think I am starting to understand what you're after. You want to > ensure the scope defined in your query_scope configuration block in > the controller is used to set the scope o

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-20 Thread Zach Dennis
On Sun, Apr 19, 2009 at 6:41 PM, Michael Schuerig wrote: > On Sunday 19 April 2009, Zach Dennis wrote: >> On Sun, Apr 19, 2009 at 2:09 PM, Michael Schuerig > wrote: >> > On Sunday 19 April 2009, Zach Dennis wrote: >> >> On Sun, Apr 19, 2009 at 12:27 PM, Michael Schuerig >> > >> > wrote: >> >> >

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-20 Thread Tom Stuart
On 20 Apr 2009, at 02:57, Michael Schuerig wrote: I'd rather check that a particular scope is in effect for a call to #find. Just as I said. ;-) As is always the case with spec'ing Rails, I don't know which level of abstraction is the right one to check, but it seems like what you're asking

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread Michael Schuerig
On Monday 20 April 2009, David Chelimsky wrote: > >> Consider this alternative: > >> > >> describe PeopleController do > >> describe "GET index" do > >> it "assigns a list of all people filtered by virtual name > >> attributes" do people = [mock_model(Person)] > >> Person.stub!(:all).a

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread Michael Schuerig
On Monday 20 April 2009, Zach Dennis wrote: > In your original post you asked: > >"How would I go about adding support a scope expectation?" > > Given the code you've shown it is not clear exactly what you are > expecting. Do you just want to be able to expect that you call > model_class.send(:

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread Zach Dennis
On Sun, Apr 19, 2009 at 6:41 PM, Michael Schuerig wrote: > On Sunday 19 April 2009, Zach Dennis wrote: >> On Sun, Apr 19, 2009 at 2:09 PM, Michael Schuerig > wrote: >> > On Sunday 19 April 2009, Zach Dennis wrote: >> >> On Sun, Apr 19, 2009 at 12:27 PM, Michael Schuerig >> > >> > wrote: >> >> >

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread David Chelimsky
On Sun, Apr 19, 2009 at 7:19 PM, Michael Schuerig wrote: > On Monday 20 April 2009, David Chelimsky wrote: >> On Sun, Apr 19, 2009 at 5:41 PM, Michael Schuerig > wrote: >> > On Sunday 19 April 2009, Zach Dennis wrote: >> >> On Sun, Apr 19, 2009 at 2:09 PM, Michael Schuerig >> > >> > wrote: >> >>

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread Michael Schuerig
On Monday 20 April 2009, David Chelimsky wrote: > On Sun, Apr 19, 2009 at 5:41 PM, Michael Schuerig wrote: > > On Sunday 19 April 2009, Zach Dennis wrote: > >> On Sun, Apr 19, 2009 at 2:09 PM, Michael Schuerig > > > > wrote: > >> > On Sunday 19 April 2009, Zach Dennis wrote: > >> >> On Sun, Apr

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread David Chelimsky
On Sun, Apr 19, 2009 at 5:41 PM, Michael Schuerig wrote: > On Sunday 19 April 2009, Zach Dennis wrote: >> On Sun, Apr 19, 2009 at 2:09 PM, Michael Schuerig > wrote: >> > On Sunday 19 April 2009, Zach Dennis wrote: >> >> On Sun, Apr 19, 2009 at 12:27 PM, Michael Schuerig >> > >> > wrote: >> >> >

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread Michael Schuerig
On Sunday 19 April 2009, Zach Dennis wrote: > On Sun, Apr 19, 2009 at 2:09 PM, Michael Schuerig wrote: > > On Sunday 19 April 2009, Zach Dennis wrote: > >> On Sun, Apr 19, 2009 at 12:27 PM, Michael Schuerig > > > > wrote: > >> > In a Rails controller I set the scope on a model class in an > >> >

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread Zach Dennis
On Sun, Apr 19, 2009 at 2:09 PM, Michael Schuerig wrote: > On Sunday 19 April 2009, Zach Dennis wrote: >> On Sun, Apr 19, 2009 at 12:27 PM, Michael Schuerig > wrote: >> > In a Rails controller I set the scope on a model class in an around >> > filter. I have defined expectations on the model clas

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread Michael Schuerig
On Sunday 19 April 2009, Zach Dennis wrote: > On Sun, Apr 19, 2009 at 12:27 PM, Michael Schuerig wrote: > > In a Rails controller I set the scope on a model class in an around > > filter. I have defined expectations on the model classes, and > > ideally, I would add a further expectation for the

Re: [rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread Zach Dennis
On Sun, Apr 19, 2009 at 12:27 PM, Michael Schuerig wrote: > > In a Rails controller I set the scope on a model class in an around > filter. I have defined expectations on the model classes, and ideally, I > would add a further expectation for the scope. Is this already possible > in some way? How

[rspec-users] Controller spec: testing that scope is set

2009-04-19 Thread Michael Schuerig
In a Rails controller I set the scope on a model class in an around filter. I have defined expectations on the model classes, and ideally, I would add a further expectation for the scope. Is this already possible in some way? How would I go about adding support a scope expectation? Michael --