Hullo all, It sucks to write wrapper .rb files just so stories/all.rb can find and run them. So I am trawling for feedback on a small project I pushed to github a day or two ago; it provides a ''story'' executable that can be used to run your plain text stories from the command line, akin to the ''spec'' command. It''s based on Bryan Helmkamp''s script/story command that he posted to this list -- http://rubyforge.org/pipermail/rspec-users/2007-December/005194.html -- and is still pretty much all his code. The project is available on github at http://github.com/pd/story and can be installed by cloning it, `rake gem`, then installing the gem in pkg/whatever.gem. I won''t be pushing a gem of this to rubyforge for a while. The repository includes a brief readme detailing the features: - Options can be specified in stories/story.opts, which is automatically loaded if present (unlike spec, but I am too lazy to type -O so often) - Allows you to specify a single .story file, a directory full of them, nothing at all to run ./stories/stories/**/*.story, etc. - It works for both rails and non-rails projects, by allowing a --rails option to specify that stories should be run as a RailsStory - Step group definitions which should be accessible in every story can be listed using --global-steps - Deduces the default step groups to include by using the .story file''s pathname. - Step groups to be included which could not be deduced from the story filename can be listed at the top of the file, eg: # +steps: foo, bar/baz, and a really long step group name - ''and a really long step group name'' is a valid name; I prefer strings to symbols here (tho symbols will still work). This allows the story at stories/stories/foo/bar.story to include the ''foo/bar'' step group, and also permits step group names such as ''data creation''. One achingly missing feature at the moment is hooking into the config options for Spec::Story::Runner, but I didn''t have any immediate use for it so I didn''t bother. But I will probably do so soon enough. (Also, specs =) This is very tied to the layout of my own projects, and I''d be surprised if it works out of the box for most people. Right now it does mostly everything I need, so I''m curious what would be necessary to make it a viable tool for others to use. ty Kyle
> It sucks to write wrapper .rb files just so stories/all.rb can find > and run them.Very nice. I was considering moving over to the Rubyesque stories so that I don''t have to have .story files around and the wrapper like you mentioned. The wrapper is the story. http://continuousthinking.com/2008/3/5/trying-rspec-s-rubyesque-stories I''m gonna give this a try. Regards, kamal
Hi Kyle, I tried the story runner against a story. Unfortunately, it had problems executing webrat methods like ''visits''. Kindly check out this pastie: http://pastie.org/175204 I tried running it with the normal ruby wrapper and it works fine. Regards, Kamal
On Thu, Apr 3, 2008 at 7:58 AM, Kyle Hargraves <philodespotos at gmail.com> wrote:> Hullo all, > > It sucks to write wrapper .rb files just so stories/all.rb can find > and run them.Here''s what my stories/all.rb looks like: require File.dirname(__FILE__) + ''/helper'' Dir[File.dirname(__FILE__) + ''/../steps/*.rb''].each { |f| require f } with_steps_for(:general, :sessions, :blogs, :game_moderation, :user_completed_games, :searching, :puzzles, :user_media) do run_local_story "blog_story" run_local_story "user_completed_games_story" run_local_story "searching_story" run_local_story "puzzle_story" run_local_story "picathon_uploads_story" #run_local_story "game_moderation_story" end Last one is commented out, since I just added a bunch of ajaxy stuff to the pages and haven''t converted the stories over to ajax yet (if that''s possible). Each one of the steps corresponds to a controller step file that''s in /steps. Works pretty well, not much of a hassle running stories. This is for http://tanga.com. Joe
On Fri, Apr 4, 2008 at 5:21 PM, Joe Van Dyk <joe at pinkpucker.net> wrote:> On Thu, Apr 3, 2008 at 7:58 AM, Kyle Hargraves <philodespotos at gmail.com> wrote: > > Hullo all, > > > > It sucks to write wrapper .rb files just so stories/all.rb can find > > and run them. > > Here''s what my stories/all.rb looks like: > > require File.dirname(__FILE__) + ''/helper'' > Dir[File.dirname(__FILE__) + ''/../steps/*.rb''].each { |f| require f } > > with_steps_for(:general, :sessions, :blogs, :game_moderation, > :user_completed_games, :searching, :puzzles, :user_media) do > run_local_story "blog_story" > run_local_story "user_completed_games_story" > run_local_story "searching_story" > run_local_story "puzzle_story" > run_local_story "picathon_uploads_story" > #run_local_story "game_moderation_story" > end > > Last one is commented out, since I just added a bunch of ajaxy stuff > to the pages and haven''t converted the stories over to ajax yet (if > that''s possible). > > Each one of the steps corresponds to a controller step file that''s in > /steps. Works pretty well, not much of a hassle running stories. > This is for http://tanga.com. > > JoeThis works for a while, and it''s what I started with. But it didn''t scale in my experience. Firstly, I started using the same wording for steps, but they had different meanings by context; you can no longer just include everything, or you can end up running the wrong step. Moreover, one of my current suites has about 180 scenarios, which takes a minute and a half or so to run all the way through. When I''m working on a single feature, I don''t want to run 90% of the scenarios, just one or two of the stories surrounding that feature. all.rb makes that impossible, AFAIK. So you start writing individual .rb files you can run separately, which all.rb just sources. I ended up spending a lot of time managing the infrastructure instead of getting work done. brynary''s script/story relieved that headache for me. BTW, what is run_local_story? k
On Fri, Apr 4, 2008 at 7:02 AM, Kamal Fariz <kamal.fariz at gmail.com> wrote:> Hi Kyle, > > I tried the story runner against a story. Unfortunately, it had > problems executing webrat methods like ''visits''. > > Kindly check out this pastie: http://pastie.org/175204 > > I tried running it with the normal ruby wrapper and it works fine.Eh, dunno. Did you use --rails? That''s the same as my helper.rb, except I don''t require webrat (it''s a plugin, so it''s loaded automatically by rails). Ding me in #rspec at freenode if --rails fixes it, or doesn''t for that matter. My nick is pd. kyle
On 3 Apr 2008, at 15:58, Kyle Hargraves wrote:> This is very tied to the layout of my own projects, and I''d be > surprised if it works out of the box for most people. Right now it > does mostly everything I need, so I''m curious what would be necessary > to make it a viable tool for others to use.Hi Kyle Worked great out of the box for my little migration tool and its one story :) I will be able to provide better feedback when I''ve got more functionality under test, only spent a day on this project so far. Thanks for assembling the story command in a tidy package Ashley -- http://www.patchspace.co.uk/ http://aviewfromafar.net/