0

I am developing an eCommerce gem with Rails. I am trying to keep as much of the code in the app as possible. I want to make updates to, say, the shopping cart through Ajax, and then return data and an event back to allow the view to be noted in the view.

I am looking for a way to determine what becomes available to my JavaScript when and Ajax call is returned. I want to track the event, and so forth.

I am looking more for advice here than an answer, but what kind of testing framework are developers generally using for this?

I use RSpec, Capybara, and FactoryGirl for unit, request, and controller testing currently.

1 Answer 1

1

This should be helpful: Setting up javascript testing on a rails app with konacha

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. I am reading through this and trying it out. If it works, I'll accept your answer, of course. What I'm trying to do is generate an event and some objects in the global javascript scope through Ajax. Will this setup get me there? I am liking what I see so far. Thanks again.
I see this line in the linked-to 'getting started' article: It cannot access your Rails (server-side) views. Any DOM nodes you are testing need to be created on the client side (for instance with JST templates), not served out by views. I will be generating all of my js from rails views through Ajax calls (the idea is that I'm generating events and objects onto a blank slate). I just want to see if the event gets raise, and the object exists as expected. Is this setup appropriate? Thanks again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.