On 25.01.2009, at 19:01, Shalon Wood wrote:

> 1) Is it possible to wrap up the steps needed to login as a given user
> so that I can just say 'Given I am logged in as <foo>', rather than
> putting in all the steps needed in each scenario?
>

you can use global Before step but I'd keep authentication step
as visible as possible

> 2) Alternatively, how do I set a cookie so that I don't need to visit
> /login, etc?
>

You can use Merb's #request method from Cucumber which takes :jar option
and tracks cookies betweet requests. If you use subdomains, you'd have  
to
patch Merb core's test helper a little to use configurable default  
host instead of example.org,
because otherwise cookies are set for one domain, but next request  
uses a different one,
and cookie do not match => your authentication does not work.

> 3) Is it possible to use Cucumber/Webrat to test making
> xml_http_requests, so that I can test that my actions do the right  
> thing
> both for xml_http_requests and ordinary requests? E.G.,
> Paragraphs#update returns the edited paragraph block for an
> xml_http_request (most of the time), but the entire page for a normal
> request.


Just set headers (#header method of Webrat) and/or use .json in the  
URI to imitate
JS client.

MK


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to