Cucumber + Capybara testing: AJAX RequestForgeryProtection trouble since Rails 4.1 -
After updating Rail 4.1, I got cigar in a new project and found an interesting problem with Capacare.
Inside a scene I put some thumbnail portraits. The user is supposed to click on the thumbnail image link, so that he can get more information about the person he has chosen, through the magic of AJAX, information is displayed below the thumbnail. Here's how I did it in this scene:
Like normal proceedings for cases like this
response_to do Format.js end
etc.
Works perfectly in the browser and I like it.
However, cucumber and capebara do not work so easily. Here's the Capepara line which gives me a lot of headaches:
When clicking on any one of the pictures to display the person's luggage, click_link ("jack_sparrow_THUMB") # To run the scenario with @curee, I receive this error message for the above statement: Security Warning: An embedded & lt; Script & gt; Tag protected JavaScript requested on another site If you know what you are doing then go ahead and disable cross-root security on this operation to allow cross-root JavaScript embedding. (ActionController :: InvalidCrossOriginRequest)
To do this with the problem
There is a look at just available CROSS_ORIGIN_JAVASCRIPT_WARNING ...: (< / P>
Anything I can do to run my tests again without downgrading to the rail; 4.1 Or can the general request also help in the closure of forgery security? Help greatly appreciated
According to the Railway Guide "CSRF protection from remote tags":
For the case of / div>
:
p> xhr : Get: index, format :: js
Comments
Post a Comment