How is everyone structuring stories?

Bleeding-edge story-writers,

How are you structuring your specs?

I am working on a new project and tried this:

./lib
./blah
./spec
./blah
./stories

But it breaks autotest, so I moved stories parallel to lib and spec.

Also what about suffixes?

I have adopted “xyz_story_spec.rb”, and “xyz.story” for the time
being, with the line
runner = Spec::Story::runner::PlainTextStoryRunner.new(
File.expand_path(FILE).gsub(“_story_spec.rb”,
“.story”)
)

in the former. Simple to make TextMate recognise the RSpec files
(even though they aren’t, as such) and to give an extension to the
stories.

Ashley


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

On 10/23/07, Ashley M. [email protected] wrote:

Bleeding-edge story-writers,

How are you structuring your specs?

PROJECT_ROOT/spec
PROJECT_ROOT/stories

They are intended to be separate beasts. This makes it more obvious.
One thing we’ve toyed with is:

PROJECT_ROOT/behaviour/specs
PROJECT_ROOT/behaviour/stories

but then a rails view spec ends up being:

PROJECT_ROOT/behaviour/specs/views/controllername/index.html.erb_spec.rb

pretty long, ay?

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

On 10/23/07, David C. [email protected] wrote:

PROJECT_ROOT/behaviour/specs
PROJECT_ROOT/behaviour/stories

I much prefer the flat, separate specs and stories dirs. It’s hard
for me to articulate why…the best I can do is say they’re completely
different beasts, as you said, meaning they deserve their own dirs,
and they’re important first-level concepts in my project so I think
they should be a part of root.

Pat

On Oct 23, 2007, at 9:55 pm, David C. 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 :slight_smile: 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 :slight_smile:

Also…

Is there an easy way to get autotest support for behaviour/spec? I
just got it working but had to copy:
svn://rubyforge.org/var/svn/rspec/trunk/rspec/lib/autotest/
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:
super()
@kernel, @separator, @alt_separator = kernel, separator,
alt_separator
@spec_command = spec_command

   # watch out: Ruby bug (1.8.6):
   # %r(/) != /\//
   # since Ruby compares the REGEXP source, not the resulting

pattern
@test_mappings = {
# note changes to paths: ^spec/ => ^behaviour/spec/
%r%^behaviour/spec/..rb$% => kernel.proc { |filename, _|
filename
},
%r%^lib/(.
).rb$% => kernel.proc { |_, m|
[“spec/#{m[1]}_spec.rb”]
},
%r%^behaviour/spec/(spec_helper|shared/.).rb$% =>
kernel.proc {
files_matching %r%^behaviour/spec/.
_spec.rb$%
}
}
end

 # ...

end

(comment was more for my benefit later)

Perhaps there is an easier way that doesn’t involve such code
duplication.

Ashley


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

On Oct 23, 2007, at 11:02 pm, Ashley M. wrote:

Is there an easy way to get autotest support for behaviour/spec? I
just got it working but had to copy:
svn://rubyforge.org/var/svn/rspec/trunk/rspec/lib/autotest/
to ./autotest

Never mind… I found out it broke the new twin-file feature in
TextMate, and there’s NO WAY I’m sacrificing that for even a moment.

I’ve reverted to spec and stories for now. Still like the idea of
behaviour though. I’d like to be able to say “this one folder will
run my app and tell you everything it does”.

Ashley

PS I did all this messing around in darcs - working with a patch
based SCM makes life much easier. I worked in a test branch, then
applied the patches from the test repo to the main one, but I was
still able to unrecord them there, something SVN can’t do. There’s
quite a few patch-based SCMs around now (I think Mercurial would be
my second choice). Just thought I would give +1 to the idea in case
anyone has thought of using a more flexible SCM (for RSpec).


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

On 10/23/07, Ashley M. [email protected] wrote:

PS I did all this messing around in darcs - working with a patch
based SCM makes life much easier. I worked in a test branch, then
applied the patches from the test repo to the main one, but I was
still able to unrecord them there, something SVN can’t do. There’s
quite a few patch-based SCMs around now (I think Mercurial would be
my second choice). Just thought I would give +1 to the idea in case
anyone has thought of using a more flexible SCM (for RSpec).

+1 for Mercurial :slight_smile:

“app” is short for “application”,
“lib” is short for “library”
so why not shorten “behavior” to something like “beh” or “behav”
(also avoids the 2 english spellings)

/beh/specs
/beh/stories

On the note of suffixes, I’ve been using _story over _spec for story
files.
I have also add two top level directories in my project:
project/
specs/
stories/

Zach

On 10/23/07, Jonathan L. [email protected] wrote:

“app” is short for “application”,
“lib” is short for “library”
so why not shorten “behavior” to something like “beh” or “behav”
(also avoids the 2 english spellings)

/beh/specs
/beh/stories

beh

that’s why :slight_smile:

On Oct 23, 2007, at 6:32 PM, David C. wrote:

that’s why :slight_smile:


rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

could get existential, and just let it “be”
:slight_smile:

For some reason I heard that reply in Eric C.'s voice.

“beh… you guys”

fwiw I prefer separate directories - stories and specs - because they
are
targeted (intentionally) at different audiences.

I started off trying behaviour/specs and behaviour/stories but then I
thought about who would actually be looking at them in the codebase and
it
felt more natural that they should be sibling top-level directories.

Cheers,
Dan

ps. Beh!