[rspec-users] How is everyone structuring stories?

Ashley Moran work at ashleymoran.me.uk
Tue Oct 23 18:02:43 EDT 2007

On Oct 23, 2007, at 9:55 pm, David Chelimsky wrote:

> PROJECT_ROOT/behaviour/specs
> PROJECT_ROOT/behaviour/stories

I like this

> but then a rails view spec ends up being:
> PROJECT_ROOT/behaviour/specs/views/controllername/ 
> index.html.erb_spec.rb
> pretty long, ay?

I don't mind long paths, I think knowing where everything is is more  
important than absolute terseness.  Besides, what else is tabbing and  
Cmd-T'ing for?

And besides Rails will soon be a dim and distant memory for me :)  I  
am as we speak writing an ORM package so I can *finally* dump AR.  
Perhaps it will be the first open source project driven by RSpec's  
Story Runner?  Unless someone else here has anything in the works?

> Nice thing about /behaviour is that it sits right next to /app.

I agree, or lib in my case.  In fact it sits *above* lib, which is  
surely where it should be :)


Is there an easy way to get autotest support for behaviour/spec?  I  
just got it working but had to copy:
to ./autotest

and modify ./autotest/rspec.rb so the initialize looks like this:

   class Autotest::Rspec < Autotest

     def initialize(kernel=Kernel, separator=File::SEPARATOR,  
alt_separator=File::ALT_SEPARATOR) # :nodoc:
       @kernel, @separator, @alt_separator = kernel, separator,  
       @spec_command = spec_command

       # watch out: Ruby bug (1.8.6):
       # %r(/) != /\//
       # since Ruby compares the REGEXP source, not the resulting  
       @test_mappings = {
         # note changes to paths: ^spec/ => ^behaviour/spec/
         %r%^behaviour/spec/.*\.rb$% => kernel.proc { |filename, _|
         %r%^lib/(.*)\.rb$% => kernel.proc { |_, m|
         %r%^behaviour/spec/(spec_helper|shared/.*)\.rb$% =>  
kernel.proc {
           files_matching %r%^behaviour/spec/.*_spec\.rb$%

     # ...


(comment was more for my benefit later)

Perhaps there is an easier way that doesn't involve such code  


blog @ http://aviewfromafar.net/
linked-in @ http://www.linkedin.com/in/ashleymoran
currently @ home

More information about the rspec-users mailing list