Webrat::Session and response_body voodoo

6 views
Skip to first unread message

Larry Siden

unread,
Jul 18, 2010, 10:25:22 PM7/18/10
to
One of my step definitions consists of the following code: http://gist.github.com/480926.

The beginning of the output looks like this:
  Scenario: Log on to Titan                                   # features/preferredAgencies.feature:4
    When I submit username "xxx" and password "xxx" # features/step_def.rb:1
#<Webrat::Session:0x4cb67d6>
String

That's right folks: response_body is a String!  So I told myself that somewhere it must be monkey-patched, so that 

response_body.should have_selector('a', {'href' => 'mem_direct.php'}) do |element| ...

will work.  In other words, there needs to be a method with a name like, #has_selector?  on response_body.  But my alphabetized dump "puts response_body.public_methods.sort" shows no such thing.

So how is it that response_body.should have_selector... does not break?  Instead, the error is

expected the following element's content to include "Membership Directory":
       (Spec::Expectations::ExpectationNotMetError)

Even worse, the value of response_body is "", even though I believe the request has succeeded (although there is no "status" method delegated to Webrat::Session, so I don't know how to examine the HTTP status).

Reply all
Reply to author
Forward
0 new messages