[rspec-users] foo_spec.rb -> foo.rspec (proposed RSpec file name convention)

Rob Muhlestein rob at muhlestein.net
Wed Jan 10 15:56:19 EST 2007

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

More information about the rspec-users mailing list