I just wanted to put one last note here (I will be blogging about this).
WOW! I absolutely love that initialization syntax. I just went through some
old specs and replaced my stubs with the initialization hash on the mock
creation. Really sweet.
-Corey
On Jan 23, 2008 10:35 AM, David Chelimsky <
Thanks, Pat.
-Corey
On Jan 25, 2008 12:22 AM, Pat Maddox <[EMAIL PROTECTED]> wrote:
> No, the mock is set up to return nil when user= is called. Then he
> writes an example to actually expect the call to user=.
>
> Pat
>
> On Jan 23, 2008 8:02 AM, Corey Haines <[EMAIL PROTECTED]> wrote:
> > I g
No, the mock is set up to return nil when user= is called. Then he
writes an example to actually expect the call to user=.
Pat
On Jan 23, 2008 8:02 AM, Corey Haines <[EMAIL PROTECTED]> wrote:
> I get the unexpected message :user= failure.
>
> When you set up the mock with the initial parameters,
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
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
>
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
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
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
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
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]>
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
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
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
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
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
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
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,
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
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
19 matches
Mail list logo