As an interim solution, we added this as helper file in the stories root. The key was figuring out what to mixin to.
class ActionController::Integration::Session def with_input(id) with_tag('input[id=?]',id) end def with_label(text) with_tag('label',text) end def show_login_form with_tag('h2','Log In') have_tag ('form[action=?]','/sessions') do with_input('username') with_input('password') with_tag('input[class=?]','image-submit') end end def show_invitation_form have_tag('form[action=?][method=?]', membership_application_path(:show), 'get') do with_label('Invitation Code:') with_input('code') end end end -Corey On Mon, Mar 17, 2008 at 9:11 AM, Ashley Moran <[EMAIL PROTECTED]> wrote: > I have mixed feelings about this. If you do build up a library of step > > groups, having explicit scoping like this can be a great benefit. > > Agreed it makes things less convenient otherwise. > > > > Hi David > > Not sure I follow. Do you mean explicit scoping as having to type > "steps_for(:login)."? If so, I guess that would be handy to call methods > across step groups, but that would probably be bad style if they were in > different files. I see these helper methods as just a factoring out of > identical code. > > > I can see copying the helper methods to the scope in which the steps > > are executed. WDYT? > > > Do you mean copy and paste? Or have the code track down the methods you > created in the StepGroup scope and copy them into the runner scope? If so > that would be cool, it would be transparent then. Name clashes could be an > issue though. > > Syntax day-dreaming led me to think of something like this: > Given "a signed-in support user called '$name'" do |name| > @support_user = SupportUser.new > # log in, etc > end > > Given "something that needs a support user" do > give_me "a signed-in support user called 'Fred'" > @support_user.support_someone > end > > or > When "user signs in with '$username' and '$password'" do |username, > password| > # type form, click submit etc > end > > Given "a signed-in support user called '$name'" do |name| > perform_step "user signs in with 'support_user' and 'secret'" > end > > or > Then "user should see text '$text'" do |text| > page.should =~ /text/ > # type form, click submit etc > end > > Then "user should see their details" do > include_requirement "user should see text 'Adam'" > include_requirement "user should see text 'Smith'" > include_requirement "user should see text '[EMAIL PROTECTED]'" > end > > > Is anything like this currently possible? If not, would it be (a) a Good > Thing and (b) straightforward to implement? > > Ashley > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -- http://www.coreyhaines.com The Internet's Premiere source of information about Corey Haines
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users