[rspec-users] post authentication token
matt at mattwynne.net
Tue Oct 7 09:17:05 EDT 2008
Another tip is to use script/console and walk the app manually.
In script/console you get an app object which is the context that your
story steps / integration tests run in.
Loading rails blah blah blah
>> app.post "/login", :username => "matt", :password => "secret"
>> puts app.response.body
>> app.visits "/hello"
Often quite handy for having an explore when you can't figure out how
to drive something from a test.
On 7 Oct 2008, at 13:47, Zach Dennis wrote:
> On Tue, Oct 7, 2008 at 8:36 AM, Mark Thomson <mark.thomson at ieee.org>
>> Hmm, thanks. Still not sure if I'm diagnosing my problem correctly.
>> Just to
>> be clear, I don't have any user authentication going on, just a
>> Rails button_to call. I tried installing webrat and put "visits '/'
>> " in my
>> "given" step and "clicks_button" in my "when" step. However I get
>> an error
>> from my_story.rb - "No such file or directory - open
>> Presumably my issue would also apply in posting a form in a regular
>> integration test. The example on pp207-208 of AWDR doesn't suggest
>> anything needs to be done in a post call to achieve session
>> And I see here -
>> that forgery protection is actually turned off in testing - which
>> confirmed in my config/environments/test.rb. So maybe I have some
>> problem causing my response test to fail. Any other suggestions
>> would be
> Have you looked at your log/test.log file to see if there are any
> exceptions being thrown? Or at least to see what is being rendered,
> perhaps you're hitting a path you don't intend.
> Zach Dennis
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users