Hi Easy one - I just wondered why all spec files for rspec_on_rails end "_spec.rb" instead of just ".rb"? They are all inside the spec folder so surely the fact they are specs is implicit? Ashley
El 3/9/2007, a las 13:59, Ashley Moran escribi?:> Hi > > Easy one - I just wondered why all spec files for rspec_on_rails end > "_spec.rb" instead of just ".rb"? They are all inside the spec > folder so surely the fact they are specs is implicit? > > AshleyI know it''s very application-specific, but one good reason for this is that it makes finding files in TextMate much easier when you hit Command-T; you type a few characters and at a glance can distinguish between spec and implementation files. Cheers, Wincent
On Sep 3, 2007, at 7:59 AM, Ashley Moran wrote:> Hi > > Easy one - I just wondered why all spec files for rspec_on_rails end > "_spec.rb" instead of just ".rb"? They are all inside the spec > folder so surely the fact they are specs is implicit? >Personally, I think the only reason we keep it around is for Autotest, which maps xyz_spec.rb => xyz.rb. But - Feel free to name your specs however you choose. Scott
On Sep 3, 2007, at 7:59 AM, Ashley Moran wrote:> Hi > > Easy one - I just wondered why all spec files for rspec_on_rails end > "_spec.rb" instead of just ".rb"? They are all inside the spec > folder so surely the fact they are specs is implicit? >Personally, I think the only reason we keep it around is for Autotest, which maps xyz_spec.rb => xyz.rb. But - Feel free to name your specs however you choose. Scott
On 3 Sep 2007, at 13:47, Wincent Colaiuta wrote:> I know it''s very application-specific, but one good reason for this > is that it makes finding files in TextMate much easier when you hit > Command-T; you type a few characters and at a glance can distinguish > between spec and implementation files.This makes sense! However, after a bit of testing, it turns out TextMate identifies the shortest unique path, so if you have address.rb in app/models and spec/models, it displays this in the Cmd- T window: address.rb ? app/models address.rb ? spec/models TextMate''s interface never ceases to amaze me. I suppose also you could set up a spec runner to skip files not ending _spec.rb in case you wanted support code in the spec folders (not sure if this is a good idea in practice or not, just occurred to me). On 3 Sep 2007, at 13:50, Scott Taylor wrote:> Personally, I think the only reason we keep it around is for > Autotest, which maps xyz_spec.rb => xyz.rb. But - Feel free to name > your specs however you choose.Not used Autotest - I''m sure it could be made to map xyz.rb => xyz.rb too though. This satisfied my curiosity anyway - someone mentioned it on nitro- general and I realised I didn''t know where _spec came from. Thanks Ashley
On 9/3/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:> > On Sep 3, 2007, at 7:59 AM, Ashley Moran wrote: > > > Hi > > > > Easy one - I just wondered why all spec files for rspec_on_rails end > > "_spec.rb" instead of just ".rb"? They are all inside the spec > > folder so surely the fact they are specs is implicit? > > > > Personally, I think the only reason we keep it around is for > Autotest, which maps xyz_spec.rb => xyz.rb. But - Feel free to name > your specs however you choose.The autotest mapping you speak of ships with rspec, not ZenTest, so if we chose to rename the files there would be no problem.> > Scott > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On 9/3/07, Ashley Moran <work at ashleymoran.me.uk> wrote:> > On 3 Sep 2007, at 13:47, Wincent Colaiuta wrote: > > > I know it''s very application-specific, but one good reason for this > > is that it makes finding files in TextMate much easier when you hit > > Command-T; you type a few characters and at a glance can distinguish > > between spec and implementation files. > > This makes sense! However, after a bit of testing, it turns out > TextMate identifies the shortest unique path, so if you have > address.rb in app/models and spec/models, it displays this in the Cmd- > T window: > > address.rb ? app/models > address.rb ? spec/models > > TextMate''s interface never ceases to amaze me. > > I suppose also you could set up a spec runner to skip files not > ending _spec.rb in case you wanted support code in the spec folders > (not sure if this is a good idea in practice or not, just occurred to > me). > > > > On 3 Sep 2007, at 13:50, Scott Taylor wrote: > > Personally, I think the only reason we keep it around is for > > Autotest, which maps xyz_spec.rb => xyz.rb. But - Feel free to name > > your specs however you choose. > > Not used AutotestYou SHOULD!> - I''m sure it could be made to map xyz.rb => xyz.rb > too though. > > > This satisfied my curiosity anyway - someone mentioned it on nitro- > general and I realised I didn''t know where _spec came from. > > Thanks > Ashley > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On 9/3/07, Ashley Moran <work at ashleymoran.me.uk> wrote:> Hi > > Easy one - I just wondered why all spec files for rspec_on_rails end > "_spec.rb" instead of just ".rb"? They are all inside the spec > folder so surely the fact they are specs is implicit?For me, personally, if I''m in TextMate and I see a row of tabs that say: thing.rb|thing_controller.rb|thing_controller.rb|thing.rb I''m going to be confused by that. It also makes searching for the file that much more complicated because you have to start looking for the folder when you search for thing.rb instead of just looking for the filename. Thoughts about that?> > Ashley > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On 9/3/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 9/3/07, Ashley Moran <work at ashleymoran.me.uk> wrote: > > Hi > > > > Easy one - I just wondered why all spec files for rspec_on_rails end > > "_spec.rb" instead of just ".rb"? They are all inside the spec > > folder so surely the fact they are specs is implicit? > > For me, personally, if I''m in TextMate and I see a row of tabs that say: > > thing.rb|thing_controller.rb|thing_controller.rb|thing.rb > > I''m going to be confused by that. It also makes searching for the file > that much more complicated because you have to start looking for the > folder when you search for thing.rb instead of just looking for the > filename. > > Thoughts about that?>From a practical standpoint, _spec is there because it allows me todistinguish files at a glance.>From a philosophical standpoint, .rb is there because I''m writingspecifications that just happen to be implemented in Ruby. (no I would not suggest in a million years that the files be changed to .spec. That''s silly) Pat
On 9/3/07, Pat Maddox <pergesu at gmail.com> wrote:> On 9/3/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > On 9/3/07, Ashley Moran <work at ashleymoran.me.uk> wrote: > > > Hi > > > > > > Easy one - I just wondered why all spec files for rspec_on_rails end > > > "_spec.rb" instead of just ".rb"? They are all inside the spec > > > folder so surely the fact they are specs is implicit? > > > > For me, personally, if I''m in TextMate and I see a row of tabs that say: > > > > thing.rb|thing_controller.rb|thing_controller.rb|thing.rb > > > > I''m going to be confused by that. It also makes searching for the file > > that much more complicated because you have to start looking for the > > folder when you search for thing.rb instead of just looking for the > > filename. > > > > Thoughts about that? > > >From a practical standpoint, _spec is there because it allows me to > distinguish files at a glance. > > >From a philosophical standpoint, .rb is there because I''m writing > specifications that just happen to be implemented in Ruby. (no I > would not suggest in a million years that the files be changed to > .spec. That''s silly)Can''t tell if you''re being serious or sarcastic here. Is it really silly? If so, why? Maybe you''re on to something here.> > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On 9/3/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 9/3/07, Pat Maddox <pergesu at gmail.com> wrote: > > On 9/3/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > > On 9/3/07, Ashley Moran <work at ashleymoran.me.uk> wrote: > > > > Hi > > > > > > > > Easy one - I just wondered why all spec files for rspec_on_rails end > > > > "_spec.rb" instead of just ".rb"? They are all inside the spec > > > > folder so surely the fact they are specs is implicit? > > > > > > For me, personally, if I''m in TextMate and I see a row of tabs that say: > > > > > > thing.rb|thing_controller.rb|thing_controller.rb|thing.rb > > > > > > I''m going to be confused by that. It also makes searching for the file > > > that much more complicated because you have to start looking for the > > > folder when you search for thing.rb instead of just looking for the > > > filename. > > > > > > Thoughts about that? > > > > >From a practical standpoint, _spec is there because it allows me to > > distinguish files at a glance. > > > > >From a philosophical standpoint, .rb is there because I''m writing > > specifications that just happen to be implemented in Ruby. (no I > > would not suggest in a million years that the files be changed to > > .spec. That''s silly) > > Can''t tell if you''re being serious or sarcastic here. Is it really > silly? If so, why? Maybe you''re on to something here.It''s not actually silly. In fact some time last year I made all my specs end in .spec instead of .rb. The only potential problem is integration with tools, which all know how to handle .rb files. Though of course those can be configured. I don''t have a personal preference really. If others feel that naming them .spec better conveys the idea of "executable specs that happen to be implemented in Ruby" then cool. It''s silly, to me, in the sense that I don''t think it warrants much thought. otoh maybe I need to be more forward-thinking in that regard. RSpec works on JRuby, and developers could conceivably use RSpec to drive their Java-only code. RSpec obviously has the makings of a general specification library and I wouldn''t be surprised if bindings pop up for other languages now that the core is stable. So I guess I just talked myself into .spec :) Pat
On 9/3/07, Pat Maddox <pergesu at gmail.com> wrote:> On 9/3/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > On 9/3/07, Pat Maddox <pergesu at gmail.com> wrote: > > > On 9/3/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > > > On 9/3/07, Ashley Moran <work at ashleymoran.me.uk> wrote: > > > > > Hi > > > > > > > > > > Easy one - I just wondered why all spec files for rspec_on_rails end > > > > > "_spec.rb" instead of just ".rb"? They are all inside the spec > > > > > folder so surely the fact they are specs is implicit? > > > > > > > > For me, personally, if I''m in TextMate and I see a row of tabs that say: > > > > > > > > thing.rb|thing_controller.rb|thing_controller.rb|thing.rb > > > > > > > > I''m going to be confused by that. It also makes searching for the file > > > > that much more complicated because you have to start looking for the > > > > folder when you search for thing.rb instead of just looking for the > > > > filename. > > > > > > > > Thoughts about that? > > > > > > >From a practical standpoint, _spec is there because it allows me to > > > distinguish files at a glance. > > > > > > >From a philosophical standpoint, .rb is there because I''m writing > > > specifications that just happen to be implemented in Ruby. (no I > > > would not suggest in a million years that the files be changed to > > > .spec. That''s silly) > > > > Can''t tell if you''re being serious or sarcastic here. Is it really > > silly? If so, why? Maybe you''re on to something here. > > It''s not actually silly. In fact some time last year I made all my > specs end in .spec instead of .rb. The only potential problem is > integration with tools, which all know how to handle .rb files. > Though of course those can be configured. > > I don''t have a personal preference really. If others feel that naming > them .spec better conveys the idea of "executable specs that happen to > be implemented in Ruby" then cool. It''s silly, to me, in the sense > that I don''t think it warrants much thought. > > otoh maybe I need to be more forward-thinking in that regard. RSpec > works on JRuby, and developers could conceivably use RSpec to drive > their Java-only code. RSpec obviously has the makings of a general > specification library and I wouldn''t be surprised if bindings pop up > for other languages now that the core is stable. > > So I guess I just talked myself into .spec :)When I first got involved w/ rspec we batted this idea around. We landed on the convention of "_spec.rb" and, to be honest, I don''t remember why. I vaguely recall there being some problem with .spec. Perhaps it was just that it required teaching editors like TextMate to treat these files as Ruby files. I don''t remember for sure. Thinking about this a bit more, I don''t think that this is worthy of changing right now. I imagine that it would cause trouble for anybody who''s got custom rake tasks, custom actions in IDEs, etc. As for ppl using rspec to drive behaviour on other platforms, it''s still got to be interpreted as Ruby first - at least that''s how the world of JRuby is now. So I don''t think dropping the .rb buys us expansion into other platforms. But it is an interesting idea that we should stay open to. Perhaps more compelling reasons for such a change will appear in the future. Cheers, David> > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On 9/3/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 9/3/07, Pat Maddox <pergesu at gmail.com> wrote: > > On 9/3/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > > On 9/3/07, Pat Maddox <pergesu at gmail.com> wrote: > > > > On 9/3/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > > > > On 9/3/07, Ashley Moran <work at ashleymoran.me.uk> wrote: > > > > > > Hi > > > > > > > > > > > > Easy one - I just wondered why all spec files for rspec_on_rails end > > > > > > "_spec.rb" instead of just ".rb"? They are all inside the spec > > > > > > folder so surely the fact they are specs is implicit? > > > > > > > > > > For me, personally, if I''m in TextMate and I see a row of tabs that say: > > > > > > > > > > thing.rb|thing_controller.rb|thing_controller.rb|thing.rb > > > > > > > > > > I''m going to be confused by that. It also makes searching for the file > > > > > that much more complicated because you have to start looking for the > > > > > folder when you search for thing.rb instead of just looking for the > > > > > filename. > > > > > > > > > > Thoughts about that? > > > > > > > > >From a practical standpoint, _spec is there because it allows me to > > > > distinguish files at a glance. > > > > > > > > >From a philosophical standpoint, .rb is there because I''m writing > > > > specifications that just happen to be implemented in Ruby. (no I > > > > would not suggest in a million years that the files be changed to > > > > .spec. That''s silly) > > > > > > Can''t tell if you''re being serious or sarcastic here. Is it really > > > silly? If so, why? Maybe you''re on to something here. > > > > It''s not actually silly. In fact some time last year I made all my > > specs end in .spec instead of .rb. The only potential problem is > > integration with tools, which all know how to handle .rb files. > > Though of course those can be configured. > > > > I don''t have a personal preference really. If others feel that naming > > them .spec better conveys the idea of "executable specs that happen to > > be implemented in Ruby" then cool. It''s silly, to me, in the sense > > that I don''t think it warrants much thought. > > > > otoh maybe I need to be more forward-thinking in that regard. RSpec > > works on JRuby, and developers could conceivably use RSpec to drive > > their Java-only code. RSpec obviously has the makings of a general > > specification library and I wouldn''t be surprised if bindings pop up > > for other languages now that the core is stable. > > > > So I guess I just talked myself into .spec :) > > When I first got involved w/ rspec we batted this idea around. We > landed on the convention of "_spec.rb" and, to be honest, I don''t > remember why. I vaguely recall there being some problem with .spec. > Perhaps it was just that it required teaching editors like TextMate to > treat these files as Ruby files. I don''t remember for sure. > > Thinking about this a bit more, I don''t think that this is worthy of > changing right now. I imagine that it would cause trouble for anybody > who''s got custom rake tasks, custom actions in IDEs, etc.Agreed. It could turn out to just be a hassle for anyone new coming to RSpec. We don''t want that.> As for ppl > using rspec to drive behaviour on other platforms, it''s still got to > be interpreted as Ruby first - at least that''s how the world of JRuby > is now. So I don''t think dropping the .rb buys us expansion into other > platforms.YAGNI, I guess.> But it is an interesting idea that we should stay open to. Perhaps > more compelling reasons for such a change will appear in the future.Can''t you tell just how strong my feelings are on this? :) Pat
> So I guess I just talked myself into .spec :)Please don''t make such changes for rspec as a whole. I''m not particularly found of enabling yet another file type to use VIM''s ruby ftplugin. -- Cheers, Eivind Uggedal Engineer, Faculty of Social Science, MSc Computer Science, University of Oslo
On 3 Sep 2007, at 15:37, David Chelimsky wrote:> But it is an interesting idea that we should stay open to. Perhaps > more compelling reasons for such a change will appear in the future.I like the sound of .spec in a way. It shortens the filenames which is always a bonus for TM users. I can see the issue with file associations, but it''s easy enough to change these for TextMate. (Although, allegedly, there are some Ruby developers that don''t use TextMate.) In favour of .spec, Rake has its own extension (.rake). You could argue that RSpec is not much more tied to Ruby code than Rake is. Ashley
On 3 Sep 2007, at 15:03, David Chelimsky wrote:>> Not used Autotest > > You SHOULD!Why do I have a feeling I will now try it out and go WHY OH WHY DIDN''T I USE THIS BEFORE???
Ashley Moran wrote:> On 3 Sep 2007, at 15:37, David Chelimsky wrote: > > >> But it is an interesting idea that we should stay open to. Perhaps >> more compelling reasons for such a change will appear in the future. >> > > > I like the sound of .spec in a way. It shortens the filenames which > is always a bonus for TM users. I can see the issue with file > associations, but it''s easy enough to change these for TextMate. > (Although, allegedly, there are some Ruby developers that don''t use > TextMate.) > > In favour of .spec, Rake has its own extension (.rake). You could > argue that RSpec is not much more tied to Ruby code than Rake is. >Ruby isn''t the only language where BDD is being used. sheep_spec.rb says to me: this is a behaviour spec(ification) in Ruby for a sheep. SheepSpec.java or SheepSpec.cs says the same for Java or C-hash. If we come up with a programming language-independent way of representing specs, then I''m all for a .spec suffix. (Perhaps the specdoc descriptions might be something along those lines.)> AshleyCheers, Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070904/c7641ef6/attachment-0001.html
On 4 Sep 2007, at 23:36, Dan North wrote:> If we come up with a programming language-independent way of > representing specs, then I''m all for a .spec suffix. (Perhaps the > specdoc descriptions might be something along those lines.)Good point. I did consider suggesting .rspec as an extention for that reason. Think I will stick to _spec.rb for now.
On 4 Sep 2007, at 23:36, Dan North wrote:> C-hashI think you meant C-pound... <http://worsethanfailure.com/Articles/5_years_C-pound_experience.aspx>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ashley Moran wrote:> On 4 Sep 2007, at 23:36, Dan North wrote: > >> C-hash > > I think you meant C-pound... > <http://worsethanfailure.com/Articles/5_years_C-pound_experience.aspx> > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >No, #| (hash-pipe) #! (shebang) # aka ... octothorpe ... pound sign ... sharp ... number sign !!maxwellssilverhammer etc. ... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG3rxD8fKMegVjSM8RAuQWAKCBI7HxxpRpd5tTfHgv+0ovbIRXHACgklhE jTg8zGSBsT4zXNzGFEDUksY=KITf -----END PGP SIGNATURE-----
Just to throw one more opinion into the pot, you can mimic how rails handles views and do: account.spec.rb Just a thought. Robert On 9/5/07, M. Edward (Ed) Borasky <znmeb at cesmail.net> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Ashley Moran wrote: > > On 4 Sep 2007, at 23:36, Dan North wrote: > > > >> C-hash > > > > I think you meant C-pound... > > <http://worsethanfailure.com/Articles/5_years_C-pound_experience.aspx> > > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > No, #| (hash-pipe) > > #! (shebang) > > # aka ... octothorpe ... pound sign ... sharp ... number sign > > !!maxwellssilverhammer > > etc. ... > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.7 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFG3rxD8fKMegVjSM8RAuQWAKCBI7HxxpRpd5tTfHgv+0ovbIRXHACgklhE > jTg8zGSBsT4zXNzGFEDUksY> =KITf > -----END PGP SIGNATURE----- > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Robert R Evans http://robertrevans.com http://rubysnips.com