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 definin

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 = mock('

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 bu

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

2008-07-24 Thread Matt Lins
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 = mock('MyModel Class', :count => 1) >>

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 ve

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: MyModel.stub!(:count).a

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 equi

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: http://blog.davidchelimsk

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

2008-07-24 Thread Matt Lins
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) But, I'm starting to think they are not. I haven't looked at the rSpec internals to verif

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 d

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: http://rspec.lighthouseapp.com/projects/5645/tickets/478-mocks-o

[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 illustrat

Re: [rspec-users] Failing on rake but not on textmate (rails)

2008-07-24 Thread Macario Ortega
Macario Ortega wrote: > > Btw, I am with sqlite3. Hi, I think I solved the issue, I had mocha in my plugins but I was using it in just a couple of tests and this line was commented in the spec_helper.rb # config.mock_with :mocha I removed mocha from my plugins folder ran rake and this two tes

Re: [rspec-users] Failing on rake but not on textmate (rails)

2008-07-24 Thread Macario Ortega
Dan Herrera wrote: > We get failures at times when running specs with rake spec that we > can't reproduce when running in Textmate. We came to the conclusion > that it may have something to do with transactions not rolling back > before the start of the next test. So even though the models we >

Re: [rspec-users] Failing on rake but not on textmate (rails)

2008-07-24 Thread Macario Ortega
Btw, I am with sqlite3. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Failing on rake but not on textmate (rails)

2008-07-24 Thread Dan Herrera
On Thu, Jul 24, 2008 at 12:27 PM, Macario Ortega <[EMAIL PROTECTED]> wrote: > Rick Denatale wrote: >> On Mon, Jul 21, 2008 at 8:34 PM, Mark Wilden <[EMAIL PROTECTED]> >> wrote: >> >>> don't know if that explains the behavior you're seeing. >>> >>> I would like to use autotest but I can't trust

Re: [rspec-users] Failing on rake but not on textmate (rails)

2008-07-24 Thread Macario Ortega
Rick Denatale wrote: > On Mon, Jul 21, 2008 at 8:34 PM, Mark Wilden <[EMAIL PROTECTED]> > wrote: > >> don't know if that explains the behavior you're seeing. >> >> >>> I would like to use autotest but I can't trust the results. >>> >> >> autotest also does not copy the database structure. I've be

Re: [rspec-users] HTML Story Formatter

2008-07-24 Thread Jonathan Leighton
Thanks for both your answers. The copying rake task was pretty useful as I was basically intending to write the same thing after I read David's message :) Jon On Thu, 2008-07-24 at 09:29 -0700, Christopher Bailey wrote: > For another variant, with my CC.rb setup, I have a rake task as follows: >

Re: [rspec-users] HTML Story Formatter

2008-07-24 Thread Christopher Bailey
For another variant, with my CC.rb setup, I have a rake task as follows: desc "Copy RSpec Story HTML includes" task :copy_story_html_includes do if ENV['CC_BUILD_ARTIFACTS'] stories_output_dir = File.join(ENV['CC_BUILD_ARTIFACTS'], 'Stories') system "mkdir #{stories_output_dir}

[rspec-users] Speccing a respond_to block outside of a request

2008-07-24 Thread Doug Livesey
Hi -- I have a bunch of controllers whose index actions are so similar, I can safely stick most of the code in a superclass. I am having trouble, however, in speccing the index method in the superclass. It could look like this: http://pastie.org/240207 This is the class that the controllers that w

Re: [rspec-users] HTML Story Formatter

2008-07-24 Thread David Chelimsky
On Thu, Jul 24, 2008 at 7:32 AM, Jonathan Leighton <[EMAIL PROTECTED]> wrote: > Hiya, > > I am trying to use the HTML Story Formatter in conjunction with > CruiseControl.rb. I have got it outputting the stories to a file, but I > notice there are CSS and JS files linked in the head, which don't app

[rspec-users] HTML Story Formatter

2008-07-24 Thread Jonathan Leighton
Hiya, I am trying to use the HTML Story Formatter in conjunction with CruiseControl.rb. I have got it outputting the stories to a file, but I notice there are CSS and JS files linked in the head, which don't appear to be anywhere in the rspec repository. Are these files available and if so where?

Re: [rspec-users] Running all stories in a directory

2008-07-24 Thread Jim Morris
Jim Morris wrote: I have a bunch on non-rails stories, and I want to run them all with either a rake task or a script. I tried the all.rb approach from rails, but is doesn't seem to work. I do this basically... dir = File.dirname(__FILE__) tests= [] %w(story1 story2 story3).each do |f|

[rspec-users] Running all stories in a directory

2008-07-24 Thread Jim Morris
I have a bunch on non-rails stories, and I want to run them all with either a rake task or a script. I tried the all.rb approach from rails, but is doesn't seem to work. I do this basically... dir = File.dirname(__FILE__) tests= [] %w(story1 story2 story3).each do |f| tests << File.jo