Re: [rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-08-27 Thread Matt Wynne
On 28 Aug 2008, at 04:46, Scott Taylor wrote: Especially regressions. Usually you can get in a few extra specs when writing a regression that has nothing to do with the bug itself (it's a sort of testing after the fact - almost like proving theorems of an existing system). The Feathers bo

Re: [rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-08-27 Thread Scott Taylor
On Aug 27, 2008, at 2:40 PM, Matt Wynne wrote: I have another, more general tip - read this book: http://www.amazon.com/Working-Effectively-Legacy-Robert-Martin/dp/0131177052 Michael's definition of Legacy Code is simply 'code that isn't covered by tests'. So... err... that would be your who

Re: [rspec-users] story runner not running on build machine

2008-08-27 Thread Ben Mabey
aa aa wrote: > Hi, have my stories running fine here on my dev machine but they blow up > on the build machine. Rspec and Rspec-rails are installed as plugins > > When i attempt to run > >> ruby stories/all.rb >> > on the dev server i get this error > stories/steps/fields_steps.rb:1: undefi

Re: [rspec-users] story runner not running on build machine

2008-08-27 Thread aa aa
David Chelimsky wrote: > On Wed, Aug 27, 2008 at 4:42 AM, aa aa <[EMAIL PROTECTED]> wrote: >> It doesn't seem to be loading the plugin does it? > Are you using git for your project? No, we are using subversion and i used the script/install command which strips out the git dirs anyway doesn't it?

Re: [rspec-users] story runner not running on build machine

2008-08-27 Thread aa aa
aa aa wrote: > No, we are using subversion and i used the script/install command which of course, i meant > script/plugin install whoops -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforg

Re: [rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-08-27 Thread Avdi Grimm
I'll just second the other suggestions of a) getting some high-level integration tests over the app; b) doing the detailed specs just-in-time when you need to make a change; and c) reading Michael Feathers' book. I've been in the same position, and the above three points helped a lot. -- Avdi H

[rspec-users] Application-wide spec_helper method

2008-08-27 Thread Nick Hoffman
If a helper method can be used for multiple model specs, obviously it should not be placed within a specific model's spec helper file. Is there a recommended file in which to put such a method? Maybe spec/ helpers/application_helper_spec.rb ? -Nick

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread Nick Hoffman
On 2008-08-27, at 14:46, David Chelimsky wrote: If you want to (not necessarily advising this, but I've seen it done) you can do this: ['!','(',')','&'].each do |char| it "can't have #{char}" do ... end end That makes the output very verbose, but the spec file is easy to grok. Hi Da

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread Chuck Remes
We'd recommend that you start sending our your resumé. :) cr On Aug 27, 2008, at 1:55 PM, Jonathan Linowes wrote: what if my office were at Route 102 & Yahoo! Way, Suite #123 :) On Aug 27, 2008, at 2:03 PM, Nick Hoffman wrote: On 2008-08-27, at 12:57, Rahoul Baruah wrote: For th

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread Mark Wilden
On Wed, Aug 27, 2008 at 12:05 PM, Nick Hoffman <[EMAIL PROTECTED]> wrote: > On 2008-08-27, at 14:55, Jonathan Linowes wrote: > >> what if my office were at >> >>Route 102 & Yahoo! Way, Suite #123 >> >> :) >> > > Good point. Thinking about it again, there's probably not all that much > need

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread Nick Hoffman
On 2008-08-27, at 15:24, Nick Hoffman wrote: Hi David. I ended up creating valid and invalid test data, as well as a method to iterate over them and write the descriptions and examples for me. You can have a look at it at http://pastie.org/ 261175 . If you have any suggestions for improvement

Re: [rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-08-27 Thread Mark Wilden
On Wed, Aug 27, 2008 at 10:20 AM, Lake Denman <[EMAIL PROTECTED]> wrote: > def upgrade(payment) >transaction do > payment.user_id = self.id > payment.payment_type = Payment::SUBSCRIPTION_PAYMENT_TYPE > return false unless (payment.save and payment.external_id) > self.subsc

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread Nick Hoffman
On 2008-08-27, at 14:55, Jonathan Linowes wrote: what if my office were at Route 102 & Yahoo! Way, Suite #123 :) Good point. Thinking about it again, there's probably not all that much need to prevent addresses from having symbols such as !, &, ", etc. If people really want to put

Re: [rspec-users] Documentation for Plain-Text Stories

2008-08-27 Thread aslak hellesoy
On Thu, Aug 21, 2008 at 6:08 PM, Joseph Wilk <[EMAIL PROTECTED]> wrote: > Hello, > > I've been looking through the cucumber documentation and have a couple > of questions. > Hi, Sorry for the late reply, > I'm curious which of the disadvantages you list would be impossible/very > difficult in the

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread Jonathan Linowes
what if my office were at Route 102 & Yahoo! Way, Suite #123 :) On Aug 27, 2008, at 2:03 PM, Nick Hoffman wrote: On 2008-08-27, at 12:57, Rahoul Baruah wrote: For this, trivial, example, I find that far too verbose. The "specification" says "if it is less than 2 characters then i

Re: [rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-08-27 Thread Matt Wynne
I have another, more general tip - read this book: http://www.amazon.com/Working-Effectively-Legacy-Robert-Martin/dp/ 0131177052 Michael's definition of Legacy Code is simply 'code that isn't covered by tests'. So... err... that would be your whole app! The book suggests chipping away at th

Re: [rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-08-27 Thread Pat Maddox
On Wed, Aug 27, 2008 at 1:20 PM, Lake Denman <[EMAIL PROTECTED]> wrote: > The project has been written - around 10,000 lines of code, but > certainly less than that to add tests to. There has been no official > testing put into place, and I'd very much like to implement RSpec into > the project for

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread David Chelimsky
On Wed, Aug 27, 2008 at 1:03 PM, Nick Hoffman <[EMAIL PROTECTED]> wrote: > On 2008-08-27, at 12:57, Rahoul Baruah wrote: > >> For this, trivial, example, I find that far too verbose. >> >> The "specification" says "if it is less than 2 characters then invalid" >> and "if it is more than 128 charac

Re: [rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-08-27 Thread Nick Hoffman
On 2008-08-27, at 13:20, Lake Denman wrote: For a visual guide: def upgrade(payment) transaction do payment.user_id = self.id payment.payment_type = Payment::SUBSCRIPTION_PAYMENT_TYPE return false unless (payment.save and payment.external_id) self.subscription_id = payment

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread Nick Hoffman
On 2008-08-27, at 12:57, Rahoul Baruah wrote: For this, trivial, example, I find that far too verbose. The "specification" says "if it is less than 2 characters then invalid" and "if it is more than 128 characters then invalid" . But you are actually running three checks - "if less than 2",

[rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-08-27 Thread Lake Denman
The project has been written - around 10,000 lines of code, but certainly less than that to add tests to. There has been no official testing put into place, and I'd very much like to implement RSpec into the project for a few reasons, but mostly to setup solid examples for the behavior of the appli

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread Rahoul Baruah
On 27 Aug 2008, at 16:35, Matt Wynne wrote: describe "when the address is less than two characters long" do it "should be invalid" do ... end end describe "when the address is more than two characters long" do describe "and the address is less than 128 characters long" do

Re: [rspec-users] array_including()

2008-08-27 Thread Zach Dennis
On Wed, Aug 27, 2008 at 12:28 PM, Matt Wynne <[EMAIL PROTECTED]> wrote: > On a similar vein, is there a neater way to express: > assigns[:events].include?(@event_1).should be_true assigns[:events].should include(@event_1) -- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman

Re: [rspec-users] array_including()

2008-08-27 Thread Joseph Wilk
Hello, I believe Pat Maddox has implemented a matcher that does the same thing but there has been a battle to find out what to call it: http://www.ruby-forum.com/topic/162000#new However I've not seen it in source yet. -- Joseph Wilk http://www.joesniff.co.uk Matt Wynne wrote: > I found myself

Re: [rspec-users] array_including()

2008-08-27 Thread Matt Wynne
On a similar vein, is there a neater way to express: assigns[:events].include?(@event_1).should be_true cheers, Matt http://blog.mattwynne.net http://songkick.com In case you wondered: The opinions expressed in this email are my own and do not necessarily reflect the views of any former,

[rspec-users] array_including()

2008-08-27 Thread Matt Wynne
I found myself having to write this today: class ArrayMatcher def initialize(array_to_match) @array_to_match = array_to_match end def ==(other) ok = true @array_to_match.each do |item| ok = ok and other.include?(item) end ok end end def array_including(ar

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread Matt Wynne
On 25 Aug 2008, at 17:53, Nick Hoffman wrote: At the moment, my plan is to spec out the following possibilities. A property is invalid if its address: 1) doesn't begin with a digit; 2) is shorter than 2 characters; 3) is longer than 128 characters; Personally I think that if those three p

Re: [rspec-users] Upgraded to 2.1 and 1.1.4 from 2.0 and 1.1.3, no output from 'rake spec'

2008-08-27 Thread Joe Van Dyk
No, I don't get any output from that, or by using the spec command. Nothing got overwritten. Joe On Mon, Aug 25, 2008 at 4:44 PM, Matt Wynne <[EMAIL PROTECTED]> wrote: > What happens if you run an individual spec file with ruby from the command > line? > > e.g. >ruby spec/models/blog_post

Re: [rspec-users] How much test data to use in specs

2008-08-27 Thread Rahoul Baruah
Hi all, On 25 Aug 2008, at 17:53, Nick Hoffman wrote: At the moment, my plan is to spec out the following possibilities. A property is invalid if its address: 1) doesn't begin with a digit; 2) is shorter than 2 characters; 3) is longer than 128 characters; Personally I think that if those

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread David Chelimsky
On Wed, Aug 27, 2008 at 2:34 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: >> Here's the basic deal: >> >> Model.find(1).equal?(Model.find(1)) >> => false >> >> AR does not cache objects, so when you ask it for what you *think* >> might the same object twice, you get different ones. > > I thought as mu

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread Matt Wynne
On 27 Aug 2008, at 13:26, David Chelimsky wrote: On Wed, Aug 27, 2008 at 7:22 AM, Zach Dennis <[EMAIL PROTECTED]> wrote: On Wed, Aug 27, 2008 at 3:34 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: Here's the basic deal: Model.find(1).equal?(Model.find(1)) => false AR does not cache objects, so

Re: [rspec-users] story runner not running on build machine

2008-08-27 Thread David Chelimsky
On Wed, Aug 27, 2008 at 4:42 AM, aa aa <[EMAIL PROTECTED]> wrote: > Hi, have my stories running fine here on my dev machine but they blow up > on the build machine. Rspec and Rspec-rails are installed as plugins > > When i attempt to run >> ruby stories/all.rb > on the dev server i get this error >

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread David Chelimsky
On Wed, Aug 27, 2008 at 7:22 AM, Zach Dennis <[EMAIL PROTECTED]> wrote: > On Wed, Aug 27, 2008 at 3:34 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: >>> Here's the basic deal: >>> >>> Model.find(1).equal?(Model.find(1)) >>> => false >>> >>> AR does not cache objects, so when you ask it for what you *th

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread Zach Dennis
On Wed, Aug 27, 2008 at 3:34 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: >> Here's the basic deal: >> >> Model.find(1).equal?(Model.find(1)) >> => false >> >> AR does not cache objects, so when you ask it for what you *think* >> might the same object twice, you get different ones. > > I thought as mu

[rspec-users] story runner not running on build machine

2008-08-27 Thread aa aa
Hi, have my stories running fine here on my dev machine but they blow up on the build machine. Rspec and Rspec-rails are installed as plugins When i attempt to run > ruby stories/all.rb on the dev server i get this error stories/steps/fields_steps.rb:1: undefined method `steps_for' for main:Object

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread Matt Wynne
Here's the basic deal: Model.find(1).equal?(Model.find(1)) => false AR does not cache objects, so when you ask it for what you *think* might the same object twice, you get different ones. I thought as much... So does AR just cache the object's attributes instead and construct them on the fly