I think I would like to stick primarily with Rspec, because I like working close to the code and being able to easily refactor things. I do like Cucumber''s ability to easily define sequences of actions and custom plain text actions. Here are some api ideas I have to make those things better in rspec. http://gist.github.com/159123 WDYT? - Brian
On Fri, Jul 31, 2009 at 2:11 AM, Brian Takita<brian.takita at gmail.com> wrote:> I think I would like to stick primarily with Rspec, because I like > working close to the code and being able to easily refactor things. > I do like Cucumber''s ability to easily define sequences of actions and > custom plain text actions. > > Here are some api ideas I have to make those things better in rspec. > http://gist.github.com/159123 > > WDYT?Very cool ideas. I''m not sure whether I''d want them in rspec proper, but I do think that rspec should let you easily plug ideas like this into its example lifecycle management. That idea has been brewing for a while as part of rspec-2.0, but rspec-2.0 is back-burnered until after the book is off to print - I need to stay focused. What you''re proposing looks a lot like rbehave, which was the precursor to Story Runner, and then Cucumber. Story Runner introduced plain text scenarios, but still let you work in Ruby (like rbehave) if you chose to. In rbehave, your example would look like http://gist.github.com/159174 FIT''s DoFixture does the same sort of alternating part of the method with arguments. So you can write table rows like this: | can have | any | number of | arguments | between text | .. which get converted to method calls like this (pardon the camel case): canHaveNumberOfBetweenText(''any'',''arguments'') This actually dates back to smalltalk, which lets you make method calls with something akin to keyword arguments like this: message canHave: ''any''; numberOf: ''arguments'' It''s more fluid than rbehave''s name/arg structure, in which all of the args have to be at the end, and I think its a powerful idea. The lambda in the middle is a bit disconcerting. Maybe that bit would look nicer in Ruby 1.9 :) Other thoughts? Cheers, David> > - Brian > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Fri, Jul 31, 2009 at 4:36 AM, David Chelimsky<dchelimsky at gmail.com> wrote:> On Fri, Jul 31, 2009 at 2:11 AM, Brian Takita<brian.takita at gmail.com> wrote: >> I think I would like to stick primarily with Rspec, because I like >> working close to the code and being able to easily refactor things. >> I do like Cucumber''s ability to easily define sequences of actions and >> custom plain text actions. >> >> Here are some api ideas I have to make those things better in rspec. >> http://gist.github.com/159123 >> >> WDYT? > > Very cool ideas. I''m not sure whether I''d want them in rspec proper, > but I do think that rspec should let you easily plug ideas like this > into its example lifecycle management. That idea has been brewing for > a while as part of rspec-2.0, but rspec-2.0 is back-burnered until > after the book is off to print - I need to stay focused. > > What you''re proposing looks a lot like rbehave, which was the > precursor to Story Runner, and then Cucumber. Story Runner introduced > plain text scenarios, but still let you work in Ruby (like rbehave) if > you chose to. In rbehave, your example would look like > http://gist.github.com/159174 > > FIT''s DoFixture does the same sort of alternating part of the method > with arguments. So you can write table rows like this: > > | can have | any | number of | arguments | between text | > > .. which get converted to method calls like this (pardon the camel case): > > canHaveNumberOfBetweenText(''any'',''arguments'') > > This actually dates back to smalltalk, which lets you make method > calls with something akin to keyword arguments like this: > > message canHave: ''any''; numberOf: ''arguments''These sort of apis almost always mirror the problem at hand more closely.> > It''s more fluid than rbehave''s name/arg structure, in which all of the > args have to be at the end, and I think its a powerful idea. The > lambda in the middle is a bit disconcerting. Maybe that bit would look > nicer in Ruby 1.9 :)I actually use lambdas quite a bit in my macro invocations because the code inside needs to be executed in the context of the Example. I like the idea of using L as the lambda method. I think its a convention that is worth having.> > Other thoughts?I''m very much in support of a strong and simple core object model in which a nice DSLish api can be built on top of. I think this would open up innovation in making good api''s, since each implementer would not need to develop so much infrastructure. It would also be cool to bring the Cucumber and rspec world closer together.> > Cheers, > DavidCheers, Brian> >> >> - Brian >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Fri, Jul 31, 2009 at 7:36 AM, David Chelimsky<dchelimsky at gmail.com> wrote:> > Other thoughts?Here''s one I''ve been meaning to bring up for a while: porting Cucumber''s FIT-like table functionality to RSpec. I don''t use scenario outlines very much in Cucumber. I much prefer factories and keeping one clear narration per major execution path. To me, the real value of something like outline tables is to test edge cases: inputs x and y should produce output z, which can be either success or a distinct sort of failure. But testing edge cases in Cucumber feels a bit kludgy to me. I don''t like having to look for flash messages to tell me what succeeded or failed. I would much rather test these cases at a finer-grained level in RSpec. Using the exact same table format as a set of values for an RSpec example group to iterate over makes all kinds of sense. That would be this year''s Christmas wish for me. >8-> -- Have Fun, Steve Eley (sfeley at gmail.com) ESCAPE POD - The Science Fiction Podcast Magazine http://www.escapepod.org