Re: [rspec-users] Stubbing controller methods vs model methods

2008-01-29 Thread Chris Olsen
Hey Ben, That makes perfect sense. Thanks for pointing out the error because I don't think I would've been able to figure it out. Thanks, as well, for the stubbing/mocking tip. I will keep my eyes open for that in the future. -- Posted via http://www.ruby-forum.com/.

Re: [rspec-users] Stubbing controller methods vs model methods

2008-01-29 Thread Ben Mabey
Chris Olsen wrote: > I had an error that I couldn't figure out, then when writing up a > question for the forum I figured it out. The thing is I don't > understand why the change that was made works and why what existed > before didn't. > > Here is the initial post when I had the error: >

Re: [rspec-users] catching errors, rspec basics

2008-01-29 Thread Andrew WC Brown
lawl, David has been out of the loop a few e-mails.I left in an extra line. Thanks for the expansion Ben, adds much more clarity, On Jan 29, 2008 8:03 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Jan 29, 2008 6:55 PM, Andrew WC Brown <[EMAIL PROTECTED]> wrote: > > try it, does the same th

Re: [rspec-users] I thought the RSPec community might be interested

2008-01-29 Thread David Chelimsky
On Jan 29, 2008 4:03 PM, Rick DeNatale <[EMAIL PROTECTED]> wrote: > in my latest blog posting > :http://talklikeaduck.denhaven2.com/articles/2008/01/29/why-i-dont-mind-using-rspec-in-fact-ive-come-to-love-it Nice. And thanks! David > > -- > Rick DeNatale > > My blog on Ruby > http://talklikeadu

Re: [rspec-users] catching errors, rspec basics

2008-01-29 Thread David Chelimsky
On Jan 29, 2008 6:55 PM, Andrew WC Brown <[EMAIL PROTECTED]> wrote: > try it, does the same thing ='( Shouldn't be the exact same thing. What's the whole error? Also - what version of rspec? If trunk, do you have the latest (3268)? > > > > On Jan 29, 2008 7:49 PM, Shane Mingins <[EMAIL PROTECTED

Re: [rspec-users] (no subject)

2008-01-29 Thread Pat Maddox
On Jan 29, 2008 8:48 PM, James B. Byrne <[EMAIL PROTECTED]> wrote: > Message-ID:<[EMAIL PROTECTED]> > > On: Tue, 29 Jan 2008 20:47:41 -0500, "Andrew WC Brown" <[EMAIL PROTECTED]> > wrote: > > > I've seen lambda before but not sure what it does. > > A lambda is a fancy name for an anonymous or unbou

[rspec-users] (no subject)

2008-01-29 Thread James B. Byrne
Message-ID:<[EMAIL PROTECTED]> On: Tue, 29 Jan 2008 20:47:41 -0500, "Andrew WC Brown" <[EMAIL PROTECTED]> wrote: > I've seen lambda before but not sure what it does. A lambda is a fancy name for an anonymous or unbound function. Its significance comes from the fact that it is completely statele

Re: [rspec-users] catching errors, rspec basics

2008-01-29 Thread Ben Mabey
Sematics.. the method is never returning an error, it raises one. So you can't say @audience.stats="dsfds" and expect to see an exception returned right? Since an exception is being raised you have to think of another way of testing it aside from checking it's return value... So you could do

Re: [rspec-users] catching errors, rspec basics

2008-01-29 Thread Andrew WC Brown
So if I understand correctly, The following didn't raise an error: @audience.stats = 'Market Goblin' @audience.stats.should raise_error because audience.stats didn't return an error. Where as lambda will return an error. On Jan 29, 2008 10:58 PM, Ben Mabey <[EMAIL PROTECTED]> wrote: > Andrew W

Re: [rspec-users] catching errors, rspec basics

2008-01-29 Thread Ben Mabey
Andrew WC Brown wrote: > oh, I left in: > > it "should return an error when passed a string" do > @audience.stats = 'Market Goblin' > lambda [EMAIL PROTECTED] = 'Market Goblin'}.should raise_error > end > > when yours is: > > it "should return an error when passed a string" do >

Re: [rspec-users] I thought the RSPec community might be interested

2008-01-29 Thread Kevin Williams
I love rspec. I wish the magic extended to ruby 1.9 so I could start looking at 1.9 with spec support. I'd rather not learn bacon + mocha just to work with 1.9, only to port back to rspec once 1.9 support is done. Just my $0.02 though. On Jan 29, 2008 4:26 PM, Corey Haines <[EMAIL PROTECTED]> wrot

Re: [rspec-users] catching errors, rspec basics

2008-01-29 Thread Andrew WC Brown
oh, I left in: it "should return an error when passed a string" do @audience.stats = 'Market Goblin' lambda [EMAIL PROTECTED] = 'Market Goblin'}.should raise_error end when yours is: it "should return an error when passed a string" do lambda [EMAIL PROTECTED] = 'Market Gobli

Re: [rspec-users] helper methods starting with should

2008-01-29 Thread David James
-1* I upgraded a Rails project from rspec 0.9 to 1.1.2 -- and this change caused me some pain. Luckily, I figured it out and confirmed it here on the list before things got too bad. :) * That said, I have to admit that I'm not super-pleased about my helper methods that start with should_ -- they p

[rspec-users] Stubbing controller methods vs model methods

2008-01-29 Thread Chris Olsen
I had an error that I couldn't figure out, then when writing up a question for the forum I figured it out. The thing is I don't understand why the change that was made works and why what existed before didn't. Here is the initial post when I had the error: -- In th

Re: [rspec-users] catching errors, rspec basics

2008-01-29 Thread Shane Mingins
H I just ran this and 2 examples, 0 failures class Audience attr_accessor :stats def initialize(name = nil,value = nil) @name ||= 'all' @value ||= value end def stats=(flux) @stats = @value * flux / 0.025 end def market_share "The Market share is for [EMAIL PR

Re: [rspec-users] catching errors, rspec basics

2008-01-29 Thread Andrew WC Brown
try it, does the same thing ='( On Jan 29, 2008 7:49 PM, Shane Mingins <[EMAIL PROTECTED]> wrote: > Are you looking for something like this > lambda { @audience.stats = 'Market Goblin' }.should raise_error > > > On 30/01/2008, at 1:48 PM, Andrew WC Brown wrote: > > Trying to spec the following bu

Re: [rspec-users] catching errors, rspec basics

2008-01-29 Thread Shane Mingins
Are you looking for something like this lambda { @audience.stats = 'Market Goblin' }.should raise_error On 30/01/2008, at 1:48 PM, Andrew WC Brown wrote: Trying to spec the following but don't know if I'm using the right matcher. How do I spec? Plz, sugar on tops. Audience.stats - should h

[rspec-users] catching errors, rspec basics

2008-01-29 Thread Andrew WC Brown
Trying to spec the following but don't know if I'm using the right matcher. How do I spec? Plz, sugar on tops. Audience.stats - should have a stats of 80 when passed a flux of 10 - should return an error when passed a string (ERROR - 1) 1) TypeError in 'Audience.stats should return an error when

Re: [rspec-users] Textmate RSpec Bundle 'it' snippet

2008-01-29 Thread Dan North
Warning - bit of a ramble below! On 29/01/2008, Edvard Majakari <[EMAIL PROTECTED]> wrote: > > > Not if you fill it out...and the BDD way is to write one example at a > > time, not a complete spec beforehand. > > I've done it this way too (being lazy), but is it really good thing? > Often I get mo

Re: [rspec-users] I thought the RSPec community might be interested

2008-01-29 Thread Corey Haines
Very nice post, Rick. I, too, would like to hear what people mean when they say it is too "magical." I kind of like the magic. :) -Corey On Jan 29, 2008 5:03 PM, Rick DeNatale <[EMAIL PROTECTED]> wrote: > in my latest blog posting > : > http://talklikeaduck.denhaven2.com/articles/2008/01/29/why

[rspec-users] I thought the RSPec community might be interested

2008-01-29 Thread Rick DeNatale
in my latest blog posting :http://talklikeaduck.denhaven2.com/articles/2008/01/29/why-i-dont-mind-using-rspec-in-fact-ive-come-to-love-it -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ ___ rspec-users mailing list rspec-users@ruby

Re: [rspec-users] Textmate RSpec Bundle 'it' snippet

2008-01-29 Thread Pat Maddox
On Jan 29, 2008 5:43 AM, Edvard Majakari <[EMAIL PROTECTED]> wrote: > > Not if you fill it out...and the BDD way is to write one example at a > > time, not a complete spec beforehand. > > I've done it this way too (being lazy), but is it really good thing? > Often I get more insight on how an inter

Re: [rspec-users] client first, top down, outside in, etc with rails

2008-01-29 Thread Zach Dennis
Another approach to what Pat mentioned is would be to use a presenter approach. We use presenters to encapsulate view logic and they often hide (or delegate) functionality to one or more models based on the UI component you're focusing on. This route doesn't muck up your models with things that ma

Re: [rspec-users] Textmate RSpec Bundle 'it' snippet

2008-01-29 Thread Edvard Majakari
> Not if you fill it out...and the BDD way is to write one example at a > time, not a complete spec beforehand. I've done it this way too (being lazy), but is it really good thing? Often I get more insight on how an interface should look like, if I think even superficially what kinds of services a