Re: [rspec-users] DRYing up stories

2008-01-23 Thread aslak hellesoy
On Jan 24, 2008 1:04 AM, Ben Mabey <[EMAIL PROTECTED]> wrote: > While the original post had DRY in the subject line I don't see this as > a DRY issue. I see it as a visualization and maintenance issue. If I > add a new role and I want to test each action for it's permissions it > would be much ea

Re: [rspec-users] DRYing up stories

2008-01-23 Thread David Chelimsky
On Jan 23, 2008 9:30 PM, Kamal Fariz <[EMAIL PROTECTED]> wrote: > Slightly OT, but what can be done to DRY up steps? For aesthetics and > more natural sounding stories, I often have things like > > Given a user in the system > > and > > Given 2 users in the system > > where the small change is in t

Re: [rspec-users] DRYing up stories

2008-01-23 Thread Kamal Fariz
Slightly OT, but what can be done to DRY up steps? For aesthetics and more natural sounding stories, I often have things like Given a user in the system and Given 2 users in the system where the small change is in the pluralization. What I currently do is to have two steps that essentially

Re: [rspec-users] DRYing up stories

2008-01-23 Thread Ben Mabey
While the original post had DRY in the subject line I don't see this as a DRY issue. I see it as a visualization and maintenance issue. If I add a new role and I want to test each action for it's permissions it would be much easier for a customer to go down a spread sheet and designate within

Re: [rspec-users] DRYing up stories

2008-01-23 Thread aslak hellesoy
On Jan 23, 2008 10:45 PM, Neil M. Young <[EMAIL PROTECTED]> wrote: > > I'm finding that I'm writing sets of very similar scenarios to check access > permissions for each of my actions. Does anyone have suggestions on how to > dry this up: > Beware that DRY has a cost. Clarity and readability. Dav

Re: [rspec-users] DRYing up stories

2008-01-23 Thread Andrew WC Brown
Do all of these scenarios exist in the same story? Should they be dried up? Would Clarity over Cleverness apply here? On Jan 23, 2008 4:45 PM, Neil M. Young <[EMAIL PROTECTED]> wrote: > > I'm finding that I'm writing sets of very similar scenarios to check > access > permissions for each of my ac

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Corey Haines
Ah, I completely missed the :user= => in your snippet. Sorry about that. It worked, though, just the way you described it. :) Here's my spec now, wonderful: http://pastie.caboo.se/142585 Thanks, David and Jarkko! -Corey On Jan 23, 2008 1:05 PM, Jarkko Laine <[EMAIL PROTECTED]> wrote: > > On 23

Re: [rspec-users] DRYing up stories

2008-01-23 Thread Ben Mabey
Neil M. Young wrote: > I'm finding that I'm writing sets of very similar scenarios to check access > permissions for each of my actions. Does anyone have suggestions on how to > dry this up: > > Given an existing Account > And a logged in Admin > When the user visits account/manage > Then he should

[rspec-users] DRYing up stories

2008-01-23 Thread Neil M. Young
I'm finding that I'm writing sets of very similar scenarios to check access permissions for each of my actions. Does anyone have suggestions on how to dry this up: Given an existing Account And a logged in Admin When the user visits account/manage Then he should get access Given an existing Acco

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Jarkko Laine
On 23.1.2008, at 18.57, Corey Haines wrote: > Nope, that still didn't work. > Still getting > @coupon.stub!(:user=).with(@current_user) > > Here's my spec and code using your recommended way: > > spec - http://pastie.caboo.se/142451 > code - http://pastie.caboo.se/142452 > > If I add back >

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Corey Haines
Ooops, I mean still getting Mock 'Coupon_1011' received unexpected message :user= with (#) On Jan 23, 2008 11:57 AM, Corey Haines <[EMAIL PROTECTED]> wrote: > Nope, that still didn't work. > Still getting > @coupon.stub!(:user=).with(@current_user) > > Here's my spec and code using your rec

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Corey Haines
Nope, that still didn't work. Still getting @coupon.stub!(:user=).with(@current_user) Here's my spec and code using your recommended way: spec - http://pastie.caboo.se/142451 code - http://pastie.caboo.se/142452 If I add back @coupon.stub!(:user=).with(@current_user) they pass. It seem

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Jarkko Laine
On 23.1.2008, at 18.02, Corey Haines wrote: > I get the unexpected message :user= failure. > > When you set up the mock with the initial parameters, wouldn't those > be stubbing: @coupon.stub!(:user).and_return(@current_user) > You can do it like this: @coupon = mock_model(Coupon, :user= => ni

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Corey Haines
That's what I found. :) I'll reference that with my blog post. (I'll write it mostly for the experience, as it will basically outline just what your post says) On Jan 23, 2008 10:36 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: > > FYI - > http://blog.davidchelimsky.net/articles/2006/11/09/tutor

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Corey Haines
I get the unexpected message :user= failure. When you set up the mock with the initial parameters, wouldn't those be stubbing: @coupon.stub!(:user).and_return(@current_user) While, my spec says that I want :user= to be called? -corey On Jan 23, 2008 10:35 AM, David Chelimsky <[EMAIL PROTECTED]>

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Corey Haines
Strange. I'll try it again, but it failed, which was why I added the stub. Let me see if I mis-typed something. On Jan 23, 2008 10:35 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Jan 23, 2008 9:24 AM, Corey Haines <[EMAIL PROTECTED]> wrote: > > Thanks, David! > > > > Here's what I morphed

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread David Chelimsky
On Jan 23, 2008 9:24 AM, Corey Haines <[EMAIL PROTECTED]> wrote: > Thanks, David! > > Here's what I morphed the specs into: > > http://pastie.caboo.se/142411 > > And, I ended up with a blog entry that I'll write tonight. > > Basically, here's the situation I've been running into which is causing m

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread David Chelimsky
On Jan 23, 2008 9:35 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Jan 23, 2008 9:24 AM, Corey Haines <[EMAIL PROTECTED]> wrote: > > Thanks, David! > > > > Here's what I morphed the specs into: > > > > http://pastie.caboo.se/142411 > > > > And, I ended up with a blog entry that I'll write ton

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Corey Haines
Thanks, David! Here's what I morphed the specs into: http://pastie.caboo.se/142411 And, I ended up with a blog entry that I'll write tonight. Basically, here's the situation I've been running into which is causing my specs to grow. If I don't set up something to tell the coupon that it is goin

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread David Chelimsky
On Jan 23, 2008 8:49 AM, Corey Haines <[EMAIL PROTECTED]> wrote: > Of course. Thanks, David! I still am getting used to user=, rather than just > user. Thanks again. No problem. I certainly got caught by that early on. I have some more general comments. See below: > > -Corey > > > > On Jan 23, 2

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Corey Haines
Of course. Thanks, David! I still am getting used to user=, rather than just user. Thanks again. -Corey On Jan 23, 2008 9:46 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Jan 23, 2008 8:41 AM, Corey Haines <[EMAIL PROTECTED]> wrote: > > All, > > > > I'm missing something simple, I think. I

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread David Chelimsky
On Jan 23, 2008 8:41 AM, Corey Haines <[EMAIL PROTECTED]> wrote: > All, > > I'm missing something simple, I think. I am writing a spec to say that my > CouponController should create a new coupon from the form parameters, then > set the current user. Here's the spec: > > describe CouponController,

[rspec-users] Not seeing the failure

2008-01-23 Thread Corey Haines
All, I'm missing something simple, I think. I am writing a spec to say that my CouponController should create a new coupon from the form parameters, then set the current user. Here's the spec: describe CouponController, "When posting to save_coupon" do before(:each) do @expectedName = "pep

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Corey Haines
Oh, and one follow-up, the app works how I expect it to work if I run through the browser. On Jan 23, 2008 9:41 AM, Corey Haines <[EMAIL PROTECTED]> wrote: > All, > > I'm missing something simple, I think. I am writing a spec to say that my > CouponController should create a new coupon from the f

Re: [rspec-users] Rspec 1.1.2 on Windows

2008-01-23 Thread Luis Lavena
On Jan 22, 2008 2:58 PM, BenFyvie <[EMAIL PROTECTED]> wrote: > > Thanks for your quick response Luis! > > I've actually gone to the extent of creating a brand spankin new rails > project, installed the plugins, ran the bootstrap, created a simple table > with a simple test and I get the same proble

Re: [rspec-users] Changing rspec directory structure

2008-01-23 Thread Corey Haines
David just posted about the new --patterns option in the trunk. His examples don't include changing the directory structure, but I would think that it would allow that. If not, that would be a good patch. http://blog.davidchelimsky.net/articles/2008/01/20/rspec-new-pattern-option -Corey On Jan 2

[rspec-users] expect_render(...).and_return('x')

2008-01-23 Thread Rob Holland
Hi, I'm trying to spec a controller method which renders some rjs as part of a render :update block. The problem I'm having is that stub_render or expect_render don't seem to allow and_return to work. The controller method does: if @thing.save render :update do

Re: [rspec-users] integrate_views is not executing my views

2008-01-23 Thread Ze No
You are God. Thanks! You can't imagine the amount of time we wasted on that one ;-) > If that works, then you've uncovered a bug with integrate_views not > working in nested example groups. that was exactly the problem. > If so, please report it to the tracker definitely -- Posted via ht

[rspec-users] Changing rspec directory structure

2008-01-23 Thread Will Sargent
I'd like to change the rspec directory structure from /spec /model /controllers etc to /spec /unit /models /controllers /lib /functional /models /controllers etc. Basically the Jay Fields style of testing -- I want the unit tests to be run all the time on