[rspec-users] textmate => pass, autotest => failing specs ???

2008-04-15 Thread Giuseppe Bertini
Hi all, I hope I can get a quick pointer about the following problem: I have a controller spec with 38 examples, all green if run from *within* TextMate. >From the shell, however (through either rake or autotest) I get a handful of pink errors. For example, I get a few TypeErrors ("can't convert

Re: [rspec-users] textmate => pass, autotest => failing specs ???

2008-04-15 Thread Matt Berther
HI Giuseppe, I had a similar situation, only reversed. All ran with autotest, but failed in Textmate. I found the problem was in how I was including some helper modules and correcting that solved the problem. On Tue, Apr 15, 2008 at 9:20 AM, Giuseppe Bertini <[EMAIL PROTECTED]> wrote: > Hi all, >

[rspec-users] Mocking and stubbing Rails' has_many association

2008-04-15 Thread Eirik Dentz Sinclair
I'm somewhat new to testing and rspec. And I'm struggling a bit with the application of Mocks and Stubs in a Rails application. I think I'm beginning to grasp it, but I'm stuck on how to spec the following: I have a User model which has a has_many relationship to Trip models, and the impleme

Re: [rspec-users] textmate => pass, autotest => failing specs ???

2008-04-15 Thread Giuseppe Bertini
Hi Matt, > I had a similar situation, only reversed. All ran with autotest, but > failed in Textmate. I found the problem was in how I was including > some helper modules and correcting that solved the problem. right, I've heard about that before, and I thought that my problem may be similar in

Re: [rspec-users] textmate => pass, autotest => failing specs ???

2008-04-15 Thread Ben Mabey
Giuseppe Bertini wrote: > Hi Matt, > > >> I had a similar situation, only reversed. All ran with autotest, but >> failed in Textmate. I found the problem was in how I was including >> some helper modules and correcting that solved the problem. >> > > right, I've heard about that before, and

Re: [rspec-users] textmate => pass, autotest => failing specs ???

2008-04-15 Thread Giuseppe Bertini
> catch any dependencies your tests may have on each other > in order to reveal brittle tests. Following Ben's hint, I took out examples from the controller spec until I isolated the culprit. Briefly, I am switching from RSpec's built in mocking framework to Mocha and fixture_scenarios when nec

[rspec-users] before_validation callbacks bypassed when stubbing :valid?

2008-04-15 Thread Zubin Henner
I'm testing an ActiveRecord model using rspec and mocha, and found that if I stub out the :valid? method, all before_validation callbacks are also skipped! Not ideal - I still want the callbacks to execute, but the validation to return true. Anyone know how to achieve this? class Item < ActiveRec

Re: [rspec-users] textmate => pass, autotest => failing specs ???

2008-04-15 Thread Bryan Ray
That'll learn ya to use Mocha over rSpec ;) On Tue, Apr 15, 2008 at 2:27 PM, Giuseppe Bertini <[EMAIL PROTECTED]> wrote: > > catch any dependencies your tests may have on each other > > in order to reveal brittle tests. > > Following Ben's hint, I took out examples from the controller spec until

Re: [rspec-users] before_validation callbacks bypassed when stubbing :valid?

2008-04-15 Thread Ashley Moran
On 15 Apr 2008, at 23:05, Zubin Henner wrote: > Item.any_instance.stubs(:valid?).returns(true) > item = Item.new > item.valid? Any reason why you are not using pure mocks here? I assume it's not Item you are testing, but some other model that is associated with it? Ashley -- http://www.pa

Re: [rspec-users] before_validation callbacks bypassed when stubbing :vali

2008-04-15 Thread Zubin Henner
Ashley Moran wrote: > Any reason why you are not using pure mocks here? I assume it's not > Item you are testing, but some other model that is associated with it? Hi Ashley, yes, you're spot on - I'm using other associated models. I just simplified it for illustration. Here's what I'm really tes

Re: [rspec-users] how to stub the :current_user and any methods associated with it

2008-04-15 Thread newbie
> Not sure why you are stubbing entries on the controller ... entries is > called on the current user ... I have this method. I want to use this variable to loop the users @entries. So I'm testing to see that this variable is tested and works correctly. def main @entries = current_user.entrie

Re: [rspec-users] how to stub the :current_user and any methods associated with it

2008-04-15 Thread David Chelimsky
On Apr 15, 2008, at 7:08 PM, newbie wrote: >> Not sure why you are stubbing entries on the controller ... entries >> is >> called on the current user ... > > I have this method. I want to use this variable to loop the users > @entries. So I'm testing to see that this variable is tested and works

[rspec-users] Writing a story for logging in with OpenID

2008-04-15 Thread Joe Van Dyk
So I added OpenID to my application (via the openid plugin). But I'm having troubles writing the story for it -- specifically, how to mock the openid calls. Anyone got any quick pointers? ___ rspec-users mailing list rspec-users@rubyforge.org http://rub

[rspec-users] getting storyrunner success/failure status in rake task

2008-04-15 Thread Korny Sietsma
Hi folks - I'm trying to build a rake task to run our plain-text stories, both from a normal build and from our continuous integration server. However, I'm having a problem - running all.rb doesn't return any sort of success/failure - so a broken story doesn't indicate to Cruise Control that the b

Re: [rspec-users] Writing a story for logging in with OpenID

2008-04-15 Thread Bryan Ray
This is a rather open ended question, Joe. You might want to get a little more detailed. Would you happen to have any code to paste or a specific problem? I think you might have a tough time finding someone who has written specific mocks around the openid calls. On Apr 15, 2008, at 8:09 PM,

Re: [rspec-users] getting storyrunner success/failure status in rake task

2008-04-15 Thread Ben Mabey
Korny Sietsma wrote: > Hi folks - I'm trying to build a rake task to run our plain-text > stories, both from a normal build and from our continuous integration > server. > > However, I'm having a problem - running all.rb doesn't return any sort > of success/failure - so a broken story doesn't indic