[rspec-users] Is it bad to use a shared example in rspec_helper.rb?

2007-07-09 Thread Daniel N
I want to extract the method for logging in so that I don't have to include it in each before call. Is it bad to use a describe block within the rspec_helper in a rails project for controller tests? I have in my spec_helper.rb describe "an authenticated request", :shared => true do before( :ea

[rspec-users] Mocking User.find( :all, :limit => 10 )

2007-07-09 Thread Daniel N
Hi, I'm trying to setup a mock for my controller test but I can't get it to recognise the mock. I use it "should find all users" do User.should_receive(:find).with( :all, :limit => 10 ).and_return([EMAIL PROTECTED]) do_get end and in the controller @users = User.find(:all, :limit => 10

Re: [rspec-users] Mocking User.find( :all, :limit => 10 )

2007-07-09 Thread Daniel N
My Bad... Please ignore On 7/10/07, Daniel N <[EMAIL PROTECTED]> wrote: Hi, I'm trying to setup a mock for my controller test but I can't get it to recognise the mock. I use it "should find all users" do User.should_receive(:find).with( :all, :limit => 10 ).and_return([EMAIL PROTECTED]

Re: [rspec-users] Mocking User.find( :all, :limit => 10 )

2007-07-09 Thread Johan Sørensen
On Jul 9, 2007, at 5:00 PM, Daniel N wrote: My Bad... Please ignore On 7/10/07, Daniel N <[EMAIL PROTECTED]> wrote: it "should find all users" do User.should_receive(:find).with( :all, :limit => 10 ).and_return ([EMAIL PROTECTED]) do_get end Sorry for piggybacking on your post,

Re: [rspec-users] Mocking User.find( :all, :limit => 10 )

2007-07-09 Thread Josh Knowles
On 7/9/07, Johan Sørensen <[EMAIL PROTECTED]> wrote: Is there a way in RSpec to check for a specific hash key (or evaluating other things along those lines) in the parameter expectation using the should_receive(:find).with(...) construct? As opposed to getting into complicated mocking scen

Re: [rspec-users] Mocking User.find( :all, :limit => 10 )

2007-07-09 Thread Johan Sørensen
On Jul 9, 2007, at 5:38 PM, Josh Knowles wrote: On 7/9/07, Johan Sørensen <[EMAIL PROTECTED]> wrote: Is there a way in RSpec to check for a specific hash key (or evaluating other things along those lines) in the parameter expectation using the should_receive(:find).with(...) construct?

Re: [rspec-users] Mocking User.find( :all, :limit => 10 )

2007-07-09 Thread David Chelimsky
On 7/9/07, Josh Knowles <[EMAIL PROTECTED]> wrote: > > > On 7/9/07, Johan Sørensen <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > Is there a way in RSpec to check for a specific hash key (or evaluating > other things along those lines) in the parameter expectation using the > should_receive(:fi

Re: [rspec-users] Mocking User.find( :all, :limit => 10 )

2007-07-09 Thread Johan Sørensen
On Jul 9, 2007, at 5:42 PM, David Chelimsky wrote: As opposed to getting into complicated mocking scenarios, consider abstracting this logic into your model: http://blog.caboo.se/articles/2007/6/19/rspec-notes-from-the- trenches-2 Agreed that this is a good approach in terms of dealing w/ r

Re: [rspec-users] Mocking User.find( :all, :limit => 10 )

2007-07-09 Thread David Chelimsky
On 7/9/07, Johan Sørensen <[EMAIL PROTECTED]> wrote: > > > On Jul 9, 2007, at 5:42 PM, David Chelimsky wrote: > > > > > > > As opposed to getting into complicated mocking scenarios, consider > > abstracting this logic into your model: > > http://blog.caboo.se/articles/2007/6/19/rspec-notes-from-the

[rspec-users] raise_controller_errors

2007-07-09 Thread Edward Ocampo-Gooding
Hi Folks, I think I've run into a problem after upgrading to edge rspec [revision 2160], but I'm not sure where to fix things. Default controller specs that look like this: require File.dirname(__FILE__) + '/../spec_helper' describe

Re: [rspec-users] raise_controller_errors

2007-07-09 Thread David Chelimsky
Did you run "ruby script/generate rspec"? http://rspec.rubyforge.org/upgrade.html On 7/9/07, Edward Ocampo-Gooding <[EMAIL PROTECTED]> wrote: > Hi Folks, > > I think I've run into a problem after upgrading to edge rspec [revision > 2160], but I'm not sure where to fix things. > > Default controll

Re: [rspec-users] raise_controller_errors

2007-07-09 Thread Edward Ocampo-Gooding
David Chelimsky wrote: > Did you run "ruby script/generate rspec"? Yep; but this time I let it regenerate spec.opts Turns out that the --drb flag is the culprit. I'll file (or look for a similar) bug report. Edward ___ rspec-users mailing list rspec-

Re: [rspec-users] raise_controller_errors

2007-07-09 Thread David Chelimsky
On 7/9/07, Edward Ocampo-Gooding <[EMAIL PROTECTED]> wrote: > David Chelimsky wrote: > > Did you run "ruby script/generate rspec"? > > Yep; but this time I let it regenerate spec.opts > > Turns out that the --drb flag is the culprit. I don't understand how --drb is related to this. You said you we

Re: [rspec-users] raise_controller_errors

2007-07-09 Thread Edward Ocampo-Gooding
David Chelimsky wrote: > On 7/9/07, Edward Ocampo-Gooding <[EMAIL PROTECTED]> wrote: >> David Chelimsky wrote: >>> Did you run "ruby script/generate rspec"? >> Yep; but this time I let it regenerate spec.opts >> >> Turns out that the --drb flag is the culprit. > > I don't understand how --drb is r