Sorry, but the formatting seems to have gone bad below. You'll most surely figure out how to fix it though.
/axl > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:rspec-users- > [EMAIL PROTECTED] On Behalf Of Andreas Axelsson > Sent: den 15 januari 2008 10:00 > To: rspec-users > Subject: Re: [rspec-users] RSpec stories introduction > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:rspec-users- > > [EMAIL PROTECTED] On Behalf Of James B. Byrne > > Sent: den 14 januari 2008 21:56 > > To: rspec-users@rubyforge.org > > Subject: [rspec-users] RSpec stories introduction > > > > I have played a bit with RSpec specs and now want to check out > stories. > > I > > note that there is no generator for rspec stories pre se (unless I > > managed > > to miss all references to one ) and that the only directory relating > to > > stories added by installing rspec is ./stories itself. > > I had a bit of trouble with this as well, and here's what I've come up > with: > > └───projdir > ├───bin > ├───lib > │ └───vinfo > ├───spec > └───stories > ├───helpers > ├───steps > └───stories > > Lib contains the project, under the vinfo folder (that's the project > name, substitute freely), organized like any other ruby module. > Spec contains specs, module_spec.rb, etc. > Stories contains an all.rb, which sets up the local search paths and > loads all story runners from the stories\stories folder. Stories also > contain a helper.rb which loads all steps and helper modules from steps > and helpers. > RUBYLIB points to my lib folder above when developing. > > ---stories\all.rb--- > Dir[File.join(File.dirname(__FILE__), "stories", "*.rb")].each do > |file| > require File.join(File.dirname(file), File.basename(file)) > end > ---end--- > > ---stories\helper.rb--- > require 'rubygems' > Dir[File.dirname(__FILE__) + "/helpers/**/*.rb"].each do |file| > require File.join(File.dirname(file), File.basename(file)) > end > Dir[File.dirname(__FILE__) + "/steps/**/*.rb"].each do |file| > require File.join(File.dirname(file), File.basename(file)) > end > def runStory file > run File.expand_path(file).gsub(".rb", ".story") > end > ---end--- > > ---stories\somestory.rb--- > require File.join(File.dirname(__FILE__), '..', 'helper') > with_steps_for(:versiontool) do > runStory __FILE__ > end > ---end--- > > Then the steps are defined just as you describe in the various > steps\*.rb files with utility code in the helpers\*.rb files. > > I have no idea if it's the best way to set things up, but it works for > me. I've got a Rakefile in the root to run specs, stories, or all. > > ---Rakefile--- > $:.unshift('lib') > > require 'rubygems' > require 'rcov/rcovtask' > require 'spec/rake/spectask' > > task :default => [:rcov_vinfo] > task :rcov_vinfo => [:spec, :stories] > > desc "Run the unit tests with rcovrt." > Spec::Rake::SpecTask.new(:spec) do |t| > html = '../doc/vinfo_specs.html' > t.warning = true > t.rcov_dir = '../doc/coverage' > t.rcov = true > t.spec_opts = ["--color", "--format", "progress", "--format", > "html:#{html}"] > end > > desc "Run all stories" > task :stories do > html = '../doc/vinfo_stories.html' > ruby "stories/all.rb --color --format plain --format > html:#{html}" > end > ---end--- > > Hope this helps, > /Axl > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users