Rob Muhlestein
2007-Jan-10 18:31 UTC
[rspec-users] foo_spec.rb -> foo.rspec (proposed RSpec file name convention)
Is it too late to suggest some filename conventions for example rspec files--especially when bundling with gems? I see spec_foo.rb and foo_spec.rb around. Also found some foo_ex.rb around. Would having a foo.rspec be worth talking about? Or is the convention more or less to have ''spec'' in the file name? I have to confess the only real motivation I have at the moment is syntax highlighting without adding RSpec DSL tags to ruby.vim (which I went ahead and did anyway.) If acceptable as a published convention, we could then recommend to editor projects. Here''s one link suggesting how to incorporate RSpec into rake and gems: http://townx.org/running_rspec_as_a_rake_task Personally I''d like so see this convention distilled enough to be mentioned in the pickax "Creating Your Own Gems - Package Layout" section (not to mention an entire additional section dedicated to BDD to go with or replace the old asserts stuff). Loving RSpec. You actually get work done while writing that spec doc any PHB can understand, even if the application isn''t written in Ruby. Looking forward to using RSpec from JRuby to apply BDD to the legacy Java stuff. Regards, -- Rob Muhlestein http://rob.muhlestein.net
Shane Duan
2007-Jan-10 19:14 UTC
[rspec-users] foo_spec.rb -> foo.rspec (proposed RSpec file name convention)
Coming up with new extension involves buy-ins from all the editors (intelliJ, eclipse, vi, emacs), and major operation systems. So I really doubt it will take off. Having the naming convention feels like a good way to go. As for the link provided, you just meant the naming convention, right? I learned to write it just following rspec''s document. Worked out great for me, especially the rcov and rspec HTML report. On 1/10/07, Rob Muhlestein <rob at muhlestein.net> wrote:> Is it too late to suggest some filename conventions for example rspec > files--especially when bundling with gems? > > I see spec_foo.rb and foo_spec.rb around. Also found some foo_ex.rb > around. Would having a foo.rspec be worth talking about? Or is the > convention more or less to have ''spec'' in the file name? > > I have to confess the only real motivation I have at the moment is > syntax highlighting without adding RSpec DSL tags to ruby.vim (which I > went ahead and did anyway.) If acceptable as a published convention, we > could then recommend to editor projects. > > Here''s one link suggesting how to incorporate RSpec into rake and gems: > > http://townx.org/running_rspec_as_a_rake_task > > Personally I''d like so see this convention distilled enough to be > mentioned in the pickax "Creating Your Own Gems - Package Layout" > section (not to mention an entire additional section dedicated to > BDD to go with or replace the old asserts stuff). > > Loving RSpec. You actually get work done while writing that spec doc any > PHB can understand, even if the application isn''t written in Ruby. > Looking forward to using RSpec from JRuby to apply BDD to the legacy > Java stuff. > > Regards, > > -- > Rob Muhlestein > http://rob.muhlestein.net > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Shane http://www.shaneduan.com
Pat Maddox
2007-Jan-10 19:16 UTC
[rspec-users] foo_spec.rb -> foo.rspec (proposed RSpec file name convention)
On 1/10/07, Rob Muhlestein <rob at muhlestein.net> wrote:> Is it too late to suggest some filename conventions for example rspec > files--especially when bundling with gems? > > I see spec_foo.rb and foo_spec.rb around. Also found some foo_ex.rb > around. Would having a foo.rspec be worth talking about? Or is the > convention more or less to have ''spec'' in the file name?I like foo_spec.rb Pat
Bryan Liles
2007-Jan-10 19:18 UTC
[rspec-users] foo_spec.rb -> foo.rspec (proposed RSpec file name convention)
On Jan 10, 2007, at 1:31 PM, Rob Muhlestein wrote:> Is it too late to suggest some filename conventions for example rspec > files--especially when bundling with gems? > > I see spec_foo.rb and foo_spec.rb around. Also found some foo_ex.rb > around. Would having a foo.rspec be worth talking about? Or is the > convention more or less to have ''spec'' in the file name? >I would vote against this (even if my vote even mattered). I like to think of my rspecs of ruby that actually verifies my code is doing what I think it is doing.
Shane Duan
2007-Jan-10 19:26 UTC
[rspec-users] foo_spec.rb -> foo.rspec (proposed RSpec file name convention)
The history from the Java world has shown that there will never be one standard. People choose different naming for different preferences. I even have ''tc_'' prefix in the project because I never bothered the trouble after I converted them from ruby unit. On 1/10/07, Pat Maddox <pergesu at gmail.com> wrote:> On 1/10/07, Rob Muhlestein <rob at muhlestein.net> wrote: > > Is it too late to suggest some filename conventions for example rspec > > files--especially when bundling with gems? > > > > I see spec_foo.rb and foo_spec.rb around. Also found some foo_ex.rb > > around. Would having a foo.rspec be worth talking about? Or is the > > convention more or less to have ''spec'' in the file name? > > I like foo_spec.rb > > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Shane http://www.shaneduan.com
Rob Muhlestein
2007-Jan-10 20:44 UTC
[rspec-users] foo_spec.rb -> foo.rspec (proposed RSpec file name convention)
On Wed, 2007-01-10 at 11:26 -0800, Shane Duan wrote:> On 1/10/07, Pat Maddox <pergesu at gmail.com> wrote: > > On 1/10/07, Rob Muhlestein <rob at muhlestein.net> wrote: > > > Is it too late to suggest some filename conventions for example rspec > > > files--especially when bundling with gems? > > > > > > I see spec_foo.rb and foo_spec.rb around. Also found some foo_ex.rb > > > around. Would having a foo.rspec be worth talking about? Or is the > > > convention more or less to have ''spec'' in the file name? > > > > I like foo_spec.rb > [... corrected top-posting ...] > The history from the Java world has shown that there will never be one > standard. People choose different naming for different preferences. > I even have ''tc_'' prefix in the project because I never bothered the > trouble after I converted them from ruby unit.Agreed, but convention is different than standard. Perl users starting using .t for their test scripts and it stuck. After a full reread of the http://rspec.rubyforge.org site (a good one I might add) it is very clear the intent is to use foo_spec.rb and from under the ''spec/'' directory in rails. It makes sense, then, that for gems these should go in ''spec/'' next to ''lib/'' for example although I''m sure we''ll find specs in ''test/'' for many years to come. I''ll go ahead and submit a patch to ruby-vim adding the rspec DSL tags (context, setup, etc). Is there even one other vim user on this list that understands my point? Thanks -- Rob Muhlestein http://rob.muhlestein.net
Rob Muhlestein
2007-Jan-10 20:56 UTC
[rspec-users] foo_spec.rb -> foo.rspec (proposed RSpec file name convention)
On Wed, 2007-01-10 at 11:14 -0800, Shane Duan wrote:> As for the link provided, you just meant the naming convention, right? > I learned to write it just following rspec''s document. Worked out > great for me, especially the rcov and rspec HTML report.The only part I was missing was that you can replace use of the ''spec'' command with the following to make your spec a standalone ruby script: require ''rubygems'' require_gem ''rspec'' Obviously this is needed to define the ''context'', ''setup'', and the rest of the RSpec DSL. This can be derived from cracking open the ''spec'' command, but is not immediately obvious to newbies, which I still consider myself to be. By the way, this isn''t mentioned anywhere on the http://rspec.rubyforge.org web site and was not immediately obvious to me. This might be for a very good reason that I just don''t see yet, but if not, I''d like to humble suggest a note go into the example or tutorial to cover it. -- Rob Muhlestein http://rob.muhlestein.net
Rob Muhlestein
2007-Jan-10 21:15 UTC
[rspec-users] foo_spec.rb -> foo.rspec (proposed RSpec file name convention)
On Wed, 2007-01-10 at 15:44 -0500, Rob Muhlestein wrote:> I''ll go ahead and submit a patch to ruby-vim adding the rspec DSL tags > (context, setup, etc).Here are all the keywords from the RSpec DSL that I can gather from the website: context context_setup setup specify context_teardown teardown Am I missing any? I''ve got them and few others (require_gem) I''m going to submit as a ruby.vim patch to ruby-vim. Perhaps updates to the other editors might be nice as well. -- Rob Muhlestein http://rob.muhlestein.net