Re: [rspec-users] surprising...

2009-12-03 Thread rogerdpack
> You're about 4 years late to the party. We were playing around with a > variety of options back in 2005 and went with the current syntax because it > gave us the most flexibility and the highest level of decoupling, making it > easier for others to create their own matcher libraries. While it wou

Re: [rspec-users] surprising...

2009-11-30 Thread rogerdpack
> And when it did there was a lot more in the way of methods added to > Kernel, and that's one of the reasons I avoided RSpec back then, way > too much Heisenberg effect. > > With the current design, there's very little added to all Ruby > objects, just Kernel#should and Kernel#should_not and that

Re: [rspec-users] surprising...

2009-11-30 Thread Rick DeNatale
On Sun, Nov 29, 2009 at 8:53 AM, David Chelimsky wrote: > On Sun, Nov 29, 2009 at 12:33 AM, rogerdpack > wrote: >> >> It is somewhat surprising to me, as a newbie, to have to assert >> a.should be_a(Hash) >> >> That extra space in there feels awkward. >> >> Suggestion: >> >> allow for constructs

Re: [rspec-users] surprising...

2009-11-30 Thread Ashley Moran
On Nov 29, 2009, at 6:33 am, rogerdpack wrote: > It is somewhat surprising to me, as a newbie, to have to assert > a.should be_a(Hash) Hi Roger Once you see the matcher (ie be_a) as something that returns a matcher object, it makes a lot more sense. My brain is now wired to give much more wei

Re: [rspec-users] surprising...

2009-11-29 Thread David Chelimsky
On Sun, Nov 29, 2009 at 12:33 AM, rogerdpack wrote: > It is somewhat surprising to me, as a newbie, to have to assert > a.should be_a(Hash) > > That extra space in there feels awkward. > > Suggestion: > > allow for constructs like > a.should.be_a(Hash) > > Thoughts? > You're about 4 years late to

[rspec-users] surprising...

2009-11-28 Thread rogerdpack
It is somewhat surprising to me, as a newbie, to have to assert a.should be_a(Hash) That extra space in there feels awkward. Suggestion: allow for constructs like a.should.be_a(Hash) Thoughts? Much thanks. -r ___ rspec-users mailing list rspec-users@r

Re: [rspec-users] Surprising mock behavior

2008-10-23 Thread Mark Thomson
Pat Maddox wrote: Can you please post an example of the spec and production code that isn't behaving as you expect? Pat Sure, sorry been tied up with business travel this week. Here's my controller... class SubscribersController < ApplicationController def test file = File.ne

Re: [rspec-users] Surprising mock behavior

2008-10-19 Thread Mark Thomson
Zach Dennis wrote: * If you want ordered message expectations on a mock you have to explicitly tell them to be ordered. Really, you can do that? I'm curious about how. Checkout http://rspec.info/documentation/mocks/message_expectations.html And look at the Ordering section.

Re: [rspec-users] Surprising mock behavior

2008-10-19 Thread Pat Maddox
Can you please post an example of the spec and production code that isn't behaving as you expect? Pat ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Surprising mock behavior

2008-10-19 Thread Zach Dennis
On Sun, Oct 19, 2008 at 1:34 AM, Mark Thomson <[EMAIL PROTECTED]> wrote: > > Zach Dennis wrote: >> >> I'm top posting... I wish I could inline post, but you provided a lot >> of generalizations for how you think things are working on your code, >> but you don't actually post concrete code (the shou

Re: [rspec-users] Surprising mock behavior

2008-10-18 Thread Mark Thomson
Zach Dennis wrote: I'm top posting... I wish I could inline post, but you provided a lot of generalizations for how you think things are working on your code, but you don't actually post concrete code (the should_receive and should_not_receive case you mentioned that wasn't acting like you'd exp

Re: [rspec-users] Surprising mock behavior

2008-10-18 Thread Mark Thomson
Stephen Eley wrote: On Sat, Oct 18, 2008 at 9:49 PM, Mark Thomson <[EMAIL PROTECTED]> wrote: [...] What I've observed is that it behaves differently if I include a "should_not_receive('...')" expectation somewhere in the spec. In that case it seems that I can have as many "file.puts()" in th

Re: [rspec-users] Surprising mock behavior

2008-10-18 Thread Zach Dennis
I'm top posting... I wish I could inline post, but you provided a lot of generalizations for how you think things are working on your code, but you don't actually post concrete code (the should_receive and should_not_receive case you mentioned that wasn't acting like you'd expect). Perhaps this wil

Re: [rspec-users] Surprising mock behavior

2008-10-18 Thread Stephen Eley
On Sat, Oct 18, 2008 at 9:49 PM, Mark Thomson <[EMAIL PROTECTED]> wrote: > > [...] What I've observed is that it behaves differently > if I include a "should_not_receive('...')" expectation somewhere in the > spec. In that case it seems that I can have as many "file.puts()" in the > component bein

Re: [rspec-users] Surprising mock behavior

2008-10-18 Thread Mark Thomson
Stephen Eley wrote: On Fri, Oct 17, 2008 at 2:55 PM, Mark Thomson <[EMAIL PROTECTED]> wrote: and then check that the expected messages are being received - file.should_receive(:puts).with("a string").once file.should_receive(:puts).with("another string").once Here's what I'm puzzled about. I

Re: [rspec-users] Surprising mock behavior

2008-10-17 Thread Mark Wilden
On Fri, Oct 17, 2008 at 11:55 AM, Mark Thomson <[EMAIL PROTECTED]>wrote: > It seems as if "should_receive" is queuing up the messages that come into > the file object and when it tests an expectation it just looks at the next > one in line. If it doesn't match then the expectation will fail. > Y

Re: [rspec-users] Surprising mock behavior

2008-10-17 Thread Stephen Eley
On Fri, Oct 17, 2008 at 3:54 PM, Zach Dennis <[EMAIL PROTECTED]> wrote: > On Fri, Oct 17, 2008 at 3:37 PM, Stephen Eley <[EMAIL PROTECTED]> wrote: >> >> That sounds right to me. You declared 'file' as a mock. Mocks are >> bratty little children that treat it as an error and throw a tantrum >> if

Re: [rspec-users] Surprising mock behavior

2008-10-17 Thread Zach Dennis
On Fri, Oct 17, 2008 at 3:37 PM, Stephen Eley <[EMAIL PROTECTED]> wrote: > On Fri, Oct 17, 2008 at 2:55 PM, Mark Thomson <[EMAIL PROTECTED]> wrote: >> >> and then check that the expected messages are being received - >> file.should_receive(:puts).with("a string").once >> file.should_receive(:puts).

Re: [rspec-users] Surprising mock behavior

2008-10-17 Thread Stephen Eley
On Fri, Oct 17, 2008 at 2:55 PM, Mark Thomson <[EMAIL PROTECTED]> wrote: > > and then check that the expected messages are being received - > file.should_receive(:puts).with("a string").once > file.should_receive(:puts).with("another string").once > > Here's what I'm puzzled about. If I don't inclu

Re: [rspec-users] Surprising mock behavior

2008-10-17 Thread Nick Hoffman
On 2008-10-17, at 14:55, Mark Thomson wrote: ..snip.. It seems as if "should_receive" is queuing up the messages that come into the file object and when it tests an expectation it just looks at the next one in line. If it doesn't match then the expectation will fail. Hi Mark. From my unde

Re: [rspec-users] Surprising mock behavior

2008-10-17 Thread Mark Thomson
Actually, this is evidently not the whole story. I actually have two examples in the same spec, and I just realized that the other one has instances of file.should_receive(:puts) that don't seem to suffer the same limitation I described. So it looks like there is something about the example I d

[rspec-users] Surprising mock behavior

2008-10-17 Thread Mark Thomson
I'm writing my first controller spec - for a controller that already exists, and in the process have observed some behavior I find a little surprising. I'd like to know whether I'm interpreting the situation correctly... In my controller I have some stuff written to a file, i.e. file = File.n