[rspec-users] Stubbing class in controller

2008-04-18 Thread Jamie D
Hi, I am trying to stub a class in my controller and I can't get it to work, the controller code is: def show @server = Server.find(params[:id]) whm = Whm::Client.new @server @server_load = whm.loadavg end and my test code: before(:each) do @server = mock_model(Server)

Re: [rspec-users] rspec test for converting a hash to a URL string

2008-04-18 Thread Jamie D
Thanks Pat, I wrote my first custom matcher and its all working now. Jamie ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] before_validation callbacks bypassed when stubbing :vali

2008-04-18 Thread Zubin Henner
Ashley, Edvard: Thank you both for your advice and comments. For now, I've implemented fixture_replacement. Perhaps a story would be better, but this is working well for now. Cheers, Zubin -- Posted via http://www.ruby-forum.com/. ___ rspec-users maili

Re: [rspec-users] Debugging trick.

2008-04-18 Thread Scott Taylor
On Apr 18, 2008, at 5:14 PM, Rick DeNatale wrote: > Some have probably already discovered this but I've been working > through some ui stories, using the rails integration test stuff. > > I had a story where one very used step was failing in one place. The > failing expectation looked like this:

[rspec-users] Integration Test Uploading in Rails 2.0.2 was (Re: Attachment-fu + Story Runner)

2008-04-18 Thread Rick DeNatale
On Fri, Apr 4, 2008 at 7:10 PM, Joe Van Dyk <[EMAIL PROTECTED]> wrote: > On Fri, Mar 21, 2008 at 5:46 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On Fri, Mar 21, 2008 at 1:35 AM, Joe Van Dyk <[EMAIL PROTECTED]> wrote: > > > On Thu, Mar 20, 2008 at 3:34 AM, Rick DeNatale <[EMAIL PROTECTED]

[rspec-users] Debugging trick.

2008-04-18 Thread Rick DeNatale
Some have probably already discovered this but I've been working through some ui stories, using the rails integration test stuff. I had a story where one very used step was failing in one place. The failing expectation looked like this: response.should have_tag("tr.group_info_row td",grou

Re: [rspec-users] How much details is enough?

2008-04-18 Thread Matt Berther
Hi Pat, Wow. Thank you for a very nice response. As others have said, this would be a stellar blog post. As you stated, it does all depend, but the theory that you provided will help me to determine what exactly I am trying to solve with the particular test. I am definitely saving this email, and

Re: [rspec-users] Creating stories for the second resource. Very wet appro

2008-04-18 Thread Bart Zonneveld
On 17 apr 2008, at 15:44, Joseph Wilk wrote: > Hello, > > I've come across a similar problem. Sharing the steps is the easy bit. > And I've started to create a 'useful_steps.rb' for storing very common > steps. So have I. I use a lot of "Given a number of flurps in the system", and "When I add

Re: [rspec-users] rspec + github == !submodules

2008-04-18 Thread Wincent Colaiuta
El 18/4/2008, a las 14:16, David Chelimsky <[EMAIL PROTECTED]> escribió: > On Apr 18, 2008, at 3:43 AM, Dan North wrote: > >> With mercurial I nearly did a similar thing, working on my own but >> committing from two different machines. Luckily mercurial gave me a >> warning that allowed me to mak

Re: [rspec-users] rspec-users Digest, Vol 22, Issue 38

2008-04-18 Thread David Chelimsky
On Apr 18, 2008, at 6:49 AM, Wincent Colaiuta wrote: > I don't have a github account at this stage but here folllows a write- > up that you could use to start a new page. > > Cheers, > Wincent > > Using topic branches when contributing patches Thanks Wincent - very nice writeup! Posted to the wik

Re: [rspec-users] redirect_to

2008-04-18 Thread David Chelimsky
On Apr 18, 2008, at 6:16 AM, Ashley Moran wrote: > On 18 Apr 2008, at 10:39, Andy Croll wrote: >>> do_delete :) >> >> I do so love mistakes in public, don't you? > > I do this SO often - hopefully I'm not alone :) - I am starting to > wish RSpec would ask me "Didn't you mean to make a request in t

Re: [rspec-users] rspec + github == !submodules

2008-04-18 Thread David Chelimsky
On Apr 18, 2008, at 3:43 AM, Dan North wrote: With mercurial I nearly did a similar thing, working on my own but committing from two different machines. Luckily mercurial gave me a warning that allowed me to make sense of what I was doing. Not sure how this works with git but here goes. 1

Re: [rspec-users] rspec-users Digest, Vol 22, Issue 38

2008-04-18 Thread Wincent Colaiuta
El 18/4/2008, a las 11:44, "Pat Maddox" <[EMAIL PROTECTED]> escribió: > I believe that pull-merge-commit would work fine, I experimented > locally to understand the effects of handling submodule reference > merge conflicts. As I mentioned before, it is just a bit of a hassle > to have to do. Dav

Re: [rspec-users] How much details is enough?

2008-04-18 Thread Ashley Moran
On 18 Apr 2008, at 10:44, Chris Parsons wrote: > Very nice reply Pat. This would make a great blog post if you get a > chance. +1 I especially like the line "The art of all of this is identifying the set of tests that maximizes your confidence and ability to produce valuable software." Ashl

Re: [rspec-users] redirect_to

2008-04-18 Thread Ashley Moran
On 18 Apr 2008, at 10:39, Andy Croll wrote: >> do_delete :) > > I do so love mistakes in public, don't you? I do this SO often - hopefully I'm not alone :) - I am starting to wish RSpec would ask me "Didn't you mean to make a request in this example?" I'm used to it now though... it's usuall

Re: [rspec-users] Story Framework

2008-04-18 Thread Željko Filipin
Hi Ashley, Thanks for the response and sorry for the delay, I did not have the time to play with rspec these days. On Wed, Apr 16, 2008 at 10:15 AM, Ashley Moran < [EMAIL PROTECTED]> wrote: > Did you mean: "run 'login.txt'" here? No, I really got it wrong. :) I will take a look at the rest of t

Re: [rspec-users] redirect_to

2008-04-18 Thread Andy Croll
Jarkko Laine wrote: > I would perhaps use > >> it "should redirect to the previous page" do >>response.should redirect_to "/prev/page" >> end Yeah, I'd pulled it back to see what *really* simple mistake I was making. :-) I reintroduced it in my next 'write test -> fail -> write code -> p

Re: [rspec-users] How much details is enough?

2008-04-18 Thread Pat Maddox
It seems like I'm constantly making long-winded replies that would be better off in a blog post or in a book. Pat On Fri, Apr 18, 2008 at 2:44 AM, Chris Parsons <[EMAIL PROTECTED]> wrote: > Very nice reply Pat. This would make a great blog post if you get a chance. > > Thanks > Chris > > > > On

Re: [rspec-users] How much details is enough?

2008-04-18 Thread Chris Parsons
Very nice reply Pat. This would make a great blog post if you get a chance. Thanks Chris On 18 Apr 2008, at 10:15, Pat Maddox wrote: Hey Matt, The ultimate test would be one that is focused on one thing such that the test would - break every time that thing broke - break only when that th

Re: [rspec-users] redirect_to

2008-04-18 Thread Jarkko Laine
On 18.4.2008, at 12.32, Andy Croll wrote: OK I'm back and surely missing stuff again... In my controller tests I'm checking for a redirect after a destroy action. First up it's a single resource ("map.resource :cart" in routes.rb) in CartsController.rb def destroy @cart = Cart.find(sess

Re: [rspec-users] redirect_to

2008-04-18 Thread Andy Croll
Pat Maddox wrote: > do_delete :) I do so love mistakes in public, don't you? -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] redirect_to

2008-04-18 Thread Pat Maddox
> it "should redirect to the previous page" do > response.should be_redirect > end > > > Am I missing anything? do_delete :) ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] redirect_to

2008-04-18 Thread Andy Croll
OK I'm back and surely missing stuff again... In my controller tests I'm checking for a redirect after a destroy action. First up it's a single resource ("map.resource :cart" in routes.rb) in CartsController.rb def destroy @cart = Cart.find(session[:cart], :include => :items) if session[:

Re: [rspec-users] rspec + github == !submodules

2008-04-18 Thread Pat Maddox
On Fri, Apr 18, 2008 at 12:43 AM, Dan North <[EMAIL PROTECTED]> wrote: > Could a pull-merge-commit before pushing have avoided this, and should we > make that our endorsed way of working? Or am I missing something else about > how dscm works? I'm still fuzzy on the details of exactly what happened

Re: [rspec-users] How much details is enough?

2008-04-18 Thread Pat Maddox
Hey Matt, The ultimate test would be one that is focused on one thing such that the test would - break every time that thing broke - break only when that thing broke - give detailed feedback enabling you to focus on the thing's subpart necessary to identify and fix the problem The ultimat

Re: [rspec-users] rspec + github == !submodules

2008-04-18 Thread Dan North
With mercurial I nearly did a similar thing, working on my own but committing from two different machines. Luckily mercurial gave me a warning that allowed me to make sense of what I was doing. Not sure how this works with git but here goes. 1. I push from laptop1 to my central server. All is good