[rspec-users] Trouble testing a method with loop

2008-02-04 Thread David Currin
I'm having trouble working out how to test a method that contains a loop. I'm new to rspec so not sure what the best way is to tackle this. class Company ActiveRecord::Base def self.sync_with_basecamp companies = basecamp_fetch(companies) companies.each do |c| company =

[rspec-users] BDD and TDD (was Newbie question with rspec on rails)

2008-02-04 Thread David Chelimsky
On Feb 4, 2008 1:20 AM, Pat Maddox [EMAIL PROTECTED] wrote: For some info on why BDD kicks TDD's butt ... Woah! I find this deeply disturbing. I believe your heart is in the right place here, so please don't take this as a personal attack, but this statement reflects a view that I see expressed

Re: [rspec-users] Development Cycle

2008-02-04 Thread Nathan Sutton
sounds good guys, thanks :) Nathan Sutton [EMAIL PROTECTED] rspec 1.1.3 rspec_on_rails 1.1.3 rails 2.0.2 On Feb 4, 2008, at 1:14 AM, Pat Maddox wrote: On Feb 3, 2008 9:19 PM, Nathan Sutton [EMAIL PROTECTED] wrote: Hey guys, I'm trying to work out the order of development for features in

Re: [rspec-users] BDD and TDD (was Newbie question with rspec on rails)

2008-02-04 Thread Pat Maddox
On Feb 4, 2008 9:19 AM, Pat Maddox [EMAIL PROTECTED] wrote: My favorite way to explain BDD is: There's a quote that says Seek not to follow in the footsteps of masters, seek what they sought. BDD presents the seek what they sought as first-level knowledge. That should read ...presents the

[rspec-users] Problems with plugins?

2008-02-04 Thread Lance Ball
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi there I've run into a bit of a problem that I can't seem to figure out. I have a model class User which includes our acts_as_role_context library. This lib acts like most other acts_as libs, evaluating class and instance methods at

Re: [rspec-users] BDD and TDD (was Newbie question with rspec on rails)

2008-02-04 Thread Andrew WC Brown
David, I'll be your cha'Dichhttp://www.klingon.org/database/rituals.html#anchor726815 Some people still sware using TDD over BDD. On Feb 4, 2008 10:51 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Feb 4, 2008 1:20 AM, Pat Maddox [EMAIL PROTECTED] wrote: For some info on why BDD kicks

Re: [rspec-users] RESTful Routes

2008-02-04 Thread Raimond Garcia
On Feb 4, 2008 6:54 AM, Raimond Garcia [EMAIL PROTECTED] wrote: Hi, I'm trying to test the behavior of a route with a delete method. Something like this: When the admin clicks on 'delete' do delete admin_blog_path(@blog) end which raises the following exception: NoMethodError: You have

Re: [rspec-users] RESTful Routes

2008-02-04 Thread Jarkko Laine
On 4.2.2008, at 14.54, Raimond Garcia wrote: Hi, I'm trying to test the behavior of a route with a delete method. Something like this: When the admin clicks on 'delete' do delete admin_blog_path(@blog) end which raises the following exception: NoMethodError: You have a nil

[rspec-users] RESTful Routes

2008-02-04 Thread Raimond Garcia
Hi, I'm trying to test the behavior of a route with a delete method. Something like this: When the admin clicks on 'delete' do delete admin_blog_path(@blog) end which raises the following exception: NoMethodError: You have a nil object when you didn't expect it! The error occurred while

Re: [rspec-users] RESTful Routes

2008-02-04 Thread Raimond Garcia
Hi, I'm trying to test the behavior of a route with a delete method. Something like this: When the admin clicks on 'delete' do delete admin_blog_path(@blog) end which raises the following exception: NoMethodError: You have a nil object when you didn't expect it! The error occurred

Re: [rspec-users] Problems with plugins?

2008-02-04 Thread Lance Ball
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Feb 4, 2008, at 2:34 PM, David Chelimsky wrote: On Feb 4, 2008 12:57 PM, Lance Ball [EMAIL PROTECTED] wrote: When #add_user_to_role is called in the controller during my spec, the method is run, rather than being a stub as I would expect.

Re: [rspec-users] Problems with plugins?

2008-02-04 Thread David Chelimsky
On Feb 4, 2008 12:57 PM, Lance Ball [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi there I've run into a bit of a problem that I can't seem to figure out. I have a model class User which includes our acts_as_role_context library. This lib acts like most other

Re: [rspec-users] Trouble testing a method with loop

2008-02-04 Thread David Chelimsky
On Feb 4, 2008 5:24 AM, David Currin [EMAIL PROTECTED] wrote: I'm having trouble working out how to test a method that contains a loop. I'm new to rspec so not sure what the best way is to tackle this. class Company ActiveRecord::Base def self.sync_with_basecamp companies =

Re: [rspec-users] Trouble testing a method with loop

2008-02-04 Thread Pat Maddox
Extract the company creation to a method, so that that method only builds one record at a time. Test that it works properly. Then you can keep the test that you have, verifying that it creates the right number of records. Pat ___ rspec-users mailing

[rspec-users] outside-in BDD vs writing examples up front

2008-02-04 Thread Dan North
I thought I'd repost this because it had the not-very-obvious title of Re: Textmate RSpec Bundle 'it' snippet. And it seems quite timely wrt the BDD vs TDD threads. Cheers, Dan ps. Not wishing to single out Edvard below - I just happened to reply to his message in the original thread.

Re: [rspec-users] Problems with plugins?

2008-02-04 Thread David Chelimsky
On Feb 4, 2008 1:52 PM, Lance Ball [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Feb 4, 2008, at 2:34 PM, David Chelimsky wrote: On Feb 4, 2008 12:57 PM, Lance Ball [EMAIL PROTECTED] wrote: When #add_user_to_role is called in the controller during my spec,

Re: [rspec-users] Mock objects not getting unloaded between specs

2008-02-04 Thread David Chelimsky
On Feb 4, 2008 2:51 PM, Nate Clark [EMAIL PROTECTED] wrote: I'm having a frustrating experience with a mock object in one example (a Rails controller test) interfering with an actual model test in a subsequent model example. More specifically, I have spec/controllers/section_controller_spec.rb

[rspec-users] odd versioning issue

2008-02-04 Thread Matt Cowley
Hi folks, If I run rspec from textmate, or do a spec filename from the command-line, I get this message: Your RSpec on Rails plugin is incompatible with your installed RSpec. RSpec : 20080114022430 RSpec on

Re: [rspec-users] Trouble testing a method with loop

2008-02-04 Thread David Currin
Great, thanks for that, d. On 04/02/2008, Pat Maddox [EMAIL PROTECTED] wrote: Extract the company creation to a method, so that that method only builds one record at a time. Test that it works properly. Then you can keep the test that you have, verifying that it creates the right number of

Re: [rspec-users] RESTful Routes

2008-02-04 Thread Raimond Garcia
On 4.2.2008, at 19.16, Raimond Garcia wrote: Interesting Jarkko... The restful routes, seem clearer than using urls, maybe not so much for this case, but for very long urls, that include for example the title of a blog, I would rather use blog_path(@blog). Yes, I want to test the full

Re: [rspec-users] OT local version control?

2008-02-04 Thread Luis Lavena
On Feb 4, 2008 9:28 PM, Corey Haines [EMAIL PROTECTED] wrote: Since it sounds like people don't mind talking about source control, and this group has people I trust, I thought, as I went through the learning/evaluating, I'd ask questions/make statements and get people's thoughts. If people on

Re: [rspec-users] odd versioning issue

2008-02-04 Thread Luis Lavena
On Feb 4, 2008 9:48 PM, Matt Cowley [EMAIL PROTECTED] wrote: Hi folks, If I run rspec from textmate, or do a spec filename from the command-line, I get this message: Your RSpec on Rails plugin is incompatible with

Re: [rspec-users] Mock objects not getting unloaded between specs

2008-02-04 Thread Nate Clark
David, thanks for getting back. Here is the pastie with (hopefully) all the relevant code: http://pastie.caboo.se/147536 We're using the latest and greatest Rspec 1.1.3, so I don't think it's old versions that is the problem. Through some debugging, I have determined that in fact my

Re: [rspec-users] Error on nil.build

2008-02-04 Thread Chris Olsen
Ooops there was a typo on the method causing the error. It should be: It is this test that fails it should make the relation to the users do @account.should_receive(:users) # removed the .and_return do_post end Is there a better way to test that the data is being loaded into the related

[rspec-users] Spec::Runner.register_at_exit_hook in RSpec 1.1.3

2008-02-04 Thread Steve Hayes
In RSpec 1.1.3 this method is invoked from Spec::Example::ExampleGroupMethods.inherited, but it no longer exists. I noticed this trying to run my specs inside Textmate. I looked for a new version of the Textmate bundle, but there doesn't seem to be one. Re-adding the method from an earlier

Re: [rspec-users] rspec - rails put :update any examples

2008-02-04 Thread David Chelimsky
On Feb 4, 2008 9:44 PM, Brian Rowe [EMAIL PROTECTED] wrote: I'm looking for a working example of a put :update on a controller. The documentation online avoids the update function. Any help pointing to this example would be great. Trying to get to 100% coverage...can't make it without

Re: [rspec-users] Spec::Runner.register_at_exit_hook in RSpec 1.1.3

2008-02-04 Thread David Chelimsky
On Feb 4, 2008 11:15 PM, Steve Hayes [EMAIL PROTECTED] wrote: In RSpec 1.1.3 this method is invoked from Spec::Example::ExampleGroupMethods.inherited, but it no longer exists. It most certainly does. In fact, it's new in 1.1.3, so neither the method nor the call existed prior. Any chance you