Re: [rspec-users] Reusing story snippets

2008-06-18 Thread Jim Morris
Hi Dan, Thanks for the analysis. Yes I am a strong proponent of using the best tools for the job, even it means bending the rules. I like the view of the stakeholder being another program, it certainly will make the phrasing of the header easier as I was struggling with that. > One other questio

Re: [rspec-users] Reusing story snippets

2008-06-18 Thread Dan North
The bottom line here is in understanding who is the stakeholder for this story - i.e. who cares about it, who will read it and who wants to know when it goes wrong. It seems to me you are using the construct of scenarios to describe machine interactions: the request and response of service invocat

Re: [rspec-users] Reusing story snippets

2008-06-17 Thread Jim Morris
Ok here is my sugar, put in spec_helper.rb require 'rubygems' require 'spec' require 'spec/story' # simulate before(:all) and after(:all) for stories class MyListener def set_before(&block) @before= block end def set_after(&block) @after= block end def method_missing sym, *arg

Re: [rspec-users] Reusing story snippets

2008-06-17 Thread Jim Morris
Yep thats exactly the case, an entire Story specific setup/teardown for the Given, When Language API Scenario setup is obviously done in the Given, although a way to clean up if the spec fails would be nice. The listener works fine for this, its just not a very intuitive way of setting things up.

Re: [rspec-users] Reusing story snippets

2008-06-17 Thread Ben Mabey
Jim Morris wrote: Hi, Not top posting (although I prefer it ;) Cool. Are you talking directly through ruby constructs or through a browser tool like selenium? I have a helper that makes posts and gets and deletes and puts directly to the server which is implements a mostly REST-ful AP

Re: [rspec-users] Reusing story snippets

2008-06-17 Thread Jim Morris
Hi, Not top posting (although I prefer it ;) > > Cool. Are you talking directly through ruby constructs or through a > browser tool like selenium? I have a helper that makes posts and gets and deletes and puts directly to the server which is implements a mostly REST-ful API and written in Java. I

Re: [rspec-users] Reusing story snippets

2008-06-17 Thread David Chelimsky
On Jun 17, 2008, at 10:41 AM, Ben Mabey wrote: David Chelimsky wrote: Reordered your posts so my comments make sense (we prefer to avoid top-posting - even though I sometimes violate that myself :) ). On Jun 16, 11:58 pm, Jim Morris <[EMAIL PROTECTED]> wrote: I'm not using Rails, I am doin

Re: [rspec-users] Reusing story snippets

2008-06-17 Thread Ben Mabey
David Chelimsky wrote: Reordered your posts so my comments make sense (we prefer to avoid top-posting - even though I sometimes violate that myself :) ). On Jun 16, 11:58 pm, Jim Morris <[EMAIL PROTECTED]> wrote: I'm not using Rails, I am doing end to end integration testing talking to

Re: [rspec-users] Reusing story snippets

2008-06-17 Thread David Chelimsky
Reordered your posts so my comments make sense (we prefer to avoid top-posting - even though I sometimes violate that myself :) ). > On Jun 16, 11:58 pm, Jim Morris <[EMAIL PROTECTED]> wrote: >> I'm not using Rails, I am doing end to end integration testing talking >> to the server via net/http, s

Re: [rspec-users] Reusing story snippets

2008-06-17 Thread Jim Morris
Ahh ok think I found it... In my test file at the start... class MyListener def method_missing sym, *args, &block # ignore all messages you don't care about end def story_started(title, narrative) puts "...Started story #{title}" end def story_ended(title, narrative) puts

Re: [rspec-users] Reusing story snippets

2008-06-16 Thread Jim Morris
I'm not using Rails, I am doing end to end integration testing talking to the server via net/http, so RailsStory is not involved. I think the listeners may do it, I can use story_started like before(:all) and story_ended like after(:all) which will be great, presuming story_ended is always called

Re: [rspec-users] Reusing story snippets

2008-06-16 Thread David Chelimsky
On Jun 16, 2008, at 6:18 PM, Jim Morris wrote: Along similar lines is there a way to do the equivalent of before(:all) and after(:all) or after(:each) in stories? Basically I have a similar situation as above, but I need to make sure the user is logged out after each scenario. or that the user

Re: [rspec-users] Reusing story snippets

2008-06-16 Thread Jim Morris
Along similar lines is there a way to do the equivalent of before(:all) and after(:all) or after(:each) in stories? Basically I have a similar situation as above, but I need to make sure the user is logged out after each scenario. or that the user is logged in once at the start of all scenarios th

Re: [rspec-users] Reusing story snippets

2008-06-14 Thread David Chelimsky
On Jun 14, 2008, at 5:03 AM, Mikel Lindsaar wrote: I find myself doing this: Scenario "logged in user visiting the home page" do Given "A logged in user" do a_logged_in_user end When "..." Then "..." end Things have evolved a bit since Story Runner first came out. The approach you a

Re: [rspec-users] Reusing story snippets

2008-06-14 Thread Kyle Hargraves
On Sat, Jun 14, 2008 at 5:03 AM, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: > I find myself doing this: > > Scenario "logged in user visiting the home page" do > Given "A logged in user" do >a_logged_in_user > end > > When "..." > Then "..." > end > > The a_logged_in_user method is a helper

[rspec-users] Reusing story snippets

2008-06-14 Thread Mikel Lindsaar
I find myself doing this: Scenario "logged in user visiting the home page" do Given "A logged in user" do a_logged_in_user end When "..." Then "..." end The a_logged_in_user method is a helper method in helper.rb which sets up the state so that the user can browse the website. Later