Has anyone used curb (ruby curl) with cucumber?

89 views
Skip to first unread message

doug livesey

unread,
Feb 23, 2010, 6:54:10 AM2/23/10
to cu...@googlegroups.com
Hi -- I'm finding that post() is serialising my json data badly, so for that and other reasons, I want to use curl to test my web service in cucumber.
(I'm using capybara, btw.)
The problem is, on a service that I already know is working fine, I'm getting this in the body of the failed attempt to post:
  "The requested URL /mobile_app/timesheet_uploads.json was not found on this server."

The code that generates that error is:
  curl = Curl::Easy.new( mobile_app_timesheet_uploads_url( :format => "json" ) )
  curl.http_post( { upload_data: @upload_data }.to_json )
  puts curl.body_str

From my (admittedly weak) understanding of what happens in cucumber, this should work, so I'm stumped.
Can anyone advise me on how to get this to work?
Any & all help appreciated,
   Doug.

Rob Holland

unread,
Feb 24, 2010, 4:14:04 AM2/24/10
to cu...@googlegroups.com
On Tue, Feb 23, 2010 at 11:54 AM, doug livesey <bio...@gmail.com> wrote:
> Hi -- I'm finding that post() is serialising my json data badly, so for that
> and other reasons, I want to use curl to test my web service in cucumber.
> (I'm using capybara, btw.)

Doug,

You might try using my branch at
http://github.com/robholland/capybara/tree/headers and see if post
then behaves as you expected. I had a very similar issue, so I wired
up get/post/delete/put into the capybara session for the rack driver
so they behave sensibly. Also note that if you're posting JSON you'll
want to pass { 'CONTENT_TYPE' => 'application/json' } for the env
argument to the post call so that the app knows to expect JSON data.

Cheers,

Rob

doug livesey

unread,
Feb 24, 2010, 7:56:58 AM2/24/10
to cu...@googlegroups.com
Cheers, Rob -- I'll give that a bash, now -- is it easy enough to swap in?
   Doug.


--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.


doug livesey

unread,
Feb 24, 2010, 8:05:04 AM2/24/10
to cu...@googlegroups.com
I just cloned it and rake installed it, so will let you know how I get on -- thanks again.
   Doug.

doug livesey

unread,
Feb 24, 2010, 8:17:34 AM2/24/10
to cu...@googlegroups.com
Ah, damn' -- I'm using RVM, and the rake install task wants to do it with root privileges, which won't work, and the install local gem command fails as I haven't access to the ./Capybara folder or file (wherever that is).
Cheers,
   Doug.
Reply all
Reply to author
Forward
0 new messages