Re: [rspec-users] Problems with mock assigned to a constant

2008-07-25 Thread Matt Lins
Yes, gist is great! Thank you very much for taking the time to look at this. I like your suggestions very much and will use them. At this point I'm just messing around, but I don't understand why this doesn't work. One more bad implementation if you have time: http://gist.github.com/2372 I'm

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-25 Thread David Chelimsky
On Fri, Jul 25, 2008 at 8:15 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 7:57 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 12:34 AM, Matt Lins [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 12:25 AM, Scott Taylor [EMAIL PROTECTED] wrote: On

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-25 Thread Matt Lins
On Fri, Jul 25, 2008 at 8:40 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 8:15 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 7:57 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 12:34 AM, Matt Lins [EMAIL PROTECTED] wrote: On

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-25 Thread David Chelimsky
On Fri, Jul 25, 2008 at 8:44 AM, Matt Lins [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 8:40 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 8:15 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 7:57 AM, David Chelimsky [EMAIL PROTECTED] wrote: On

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-25 Thread David Chelimsky
On Fri, Jul 25, 2008 at 8:49 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 8:44 AM, Matt Lins [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 8:40 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 8:15 AM, David Chelimsky [EMAIL PROTECTED] wrote: On

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-25 Thread Matt Lins
Fair enough. Thanks. On Fri, Jul 25, 2008 at 8:53 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 8:49 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 8:44 AM, Matt Lins [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 8:40 AM, David Chelimsky [EMAIL

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-25 Thread Pat Maddox
On Fri, Jul 25, 2008 at 9:30 AM, Matt Lins [EMAIL PROTECTED] wrote: Yes, gist is great! Thank you very much for taking the time to look at this. I like your suggestions very much and will use them. At this point I'm just messing around, but I don't understand why this doesn't work. One

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-25 Thread Matt Lins
Yah, I looked around. I came out with a better understanding of rSpec's mocking internals, but no answer to the problem. I don't need it. I'll probably end up using FlexMock or Mocha for future projects anyway. I'd be happy to file a ticket if you think it's worthy of one. It was my first

[rspec-users] Problems with mock assigned to a constant

2008-07-24 Thread Matt Lins
Hi all, Initially I thought this was a bug in the built-in mocking framework(and it still may be), but I better hash it out on the mailing list before I file/reopen the ticket: http://rspec.lighthouseapp.com/projects/5645/tickets/478-mocks-on-constants#ticket-478-6 I thought my example

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-24 Thread Scott Taylor
On Jul 24, 2008, at 11:49 PM, Matt Lins wrote: Hi all, Initially I thought this was a bug in the built-in mocking framework(and it still may be), but I better hash it out on the mailing list before I file/reopen the ticket:

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-24 Thread Matt Lins
Scott, Thanks, your solution does work, although I'm not sure I like it. I like to stub out behavior in my before block but also use mock expectations to verify behavior in my specs. Similar to what Dave explains here: http://blog.davidchelimsky.net/2006/11/9/tutorial-rspec-stubs-and-mocks I

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-24 Thread Scott Taylor
On Jul 25, 2008, at 12:21 AM, Matt Lins wrote: Scott, Thanks, your solution does work, although I'm not sure I like it. I like to stub out behavior in my before block but also use mock expectations to verify behavior in my specs. Similar to what Dave explains here:

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-24 Thread Scott Taylor
On Jul 25, 2008, at 12:32 AM, Matt Lins wrote: I suppose the way I'm defining the stubs, differs from what Dave is doing in his example. I assumed that: MyModel = mock('MyModel Class', :count = 1) was the same as: MyModel.stub!(:count).and_return(1) Nope. Not even close. Here's an

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-24 Thread Scott Taylor
On Jul 25, 2008, at 12:47 AM, Scott Taylor wrote: On Jul 25, 2008, at 12:32 AM, Matt Lins wrote: I suppose the way I'm defining the stubs, differs from what Dave is doing in his example. I assumed that: MyModel = mock('MyModel Class', :count = 1) was the same as:

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-24 Thread Matt Lins
On Thu, Jul 24, 2008 at 11:38 PM, Scott Taylor [EMAIL PROTECTED] wrote: On Jul 25, 2008, at 12:21 AM, Matt Lins wrote: Scott, Thanks, your solution does work, although I'm not sure I like it. I like to stub out behavior in my before block but also use mock expectations to verify behavior

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-24 Thread Scott Taylor
On Jul 25, 2008, at 1:05 AM, Matt Lins wrote: On Thu, Jul 24, 2008 at 11:38 PM, Scott Taylor [EMAIL PROTECTED] wrote: On Jul 25, 2008, at 12:21 AM, Matt Lins wrote: Scott, Thanks, your solution does work, although I'm not sure I like it. I like to stub out behavior in my before block but

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-24 Thread Scott Taylor
On Jul 25, 2008, at 1:15 AM, Matt Lins wrote: On Thu, Jul 24, 2008 at 11:47 PM, Scott Taylor [EMAIL PROTECTED] wrote: On Jul 25, 2008, at 12:32 AM, Matt Lins wrote: I suppose the way I'm defining the stubs, differs from what Dave is doing in his example. I assumed that: MyModel =

Re: [rspec-users] Problems with mock assigned to a constant

2008-07-24 Thread Matt Lins
On Fri, Jul 25, 2008 at 12:25 AM, Scott Taylor [EMAIL PROTECTED] wrote: On Jul 25, 2008, at 1:15 AM, Matt Lins wrote: On Thu, Jul 24, 2008 at 11:47 PM, Scott Taylor [EMAIL PROTECTED] wrote: On Jul 25, 2008, at 12:32 AM, Matt Lins wrote: I suppose the way I'm defining the stubs, differs