Why does phantomjs intermittently submit GET XHR request for a rails DELETE XHR link?

236 Views Asked by At

Given the following link drawn by rails

<a id="leave_community" data-method="delete" 
    data-confirm="Are you sure?" 
    href="/group_memberships/1">
  Leave Us
</a>

And the following versions

rails 3.2.16
phantomjs 1.9.2 from brew bottle
poltergeist 1.5.0
capybara 2.2.0

When I run the following Capybara action 10 times

find("#leave_community").trigger('click')

Then five times it passed and five times I got

Internal Server Error No route matches [GET] "/group_memberships/1"

Symptom

Expected [DELETE], got [GET]

Logs

egrep -i '(GET|DELETE) "/group_memberships' log/test.log | tail -n 10
Started DELETE "/group_memberships/1" for 127.0.0.1 at 2013-12-10 20:15:12 -0500
Started GET "/group_memberships/1" for 127.0.0.1 at 2013-12-10 20:15:38 -0500
Started GET "/group_memberships/1" for 127.0.0.1 at 2013-12-10 20:16:06 -0500
Started DELETE "/group_memberships/1" for 127.0.0.1 at 2013-12-10 20:16:32 -0500
Started DELETE "/group_memberships/1" for 127.0.0.1 at 2013-12-10 20:16:57 -0500
Started GET "/group_memberships/1" for 127.0.0.1 at 2013-12-10 20:17:23 -0500
Started GET "/group_memberships/1" for 127.0.0.1 at 2013-12-10 20:17:51 -0500
Started GET "/group_memberships/1" for 127.0.0.1 at 2013-12-10 20:18:18 -0500
Started DELETE "/group_memberships/1" for 127.0.0.1 at 2013-12-10 20:18:45 -0500
Started DELETE "/group_memberships/1" for 127.0.0.1 at 2013-12-10 20:19:13 -0500

Question

Is this intermittant behavior a bug in poltergeist/phantomjs or is there some step I should take to debug this further by myself?

0

There are 0 best solutions below