views:

22

answers:

1

I have this form and in it I have this:

<%= f.select(:category_id, categories_for_select) %>
<%= f.select(:subcategory_id, options_for_select(["Choose category"])) %>

Then, when the user change the category the subcategories select box fill itself via ajax.

Both of the category and subcategory are mandatory for my model and included in the validations, so I can't save an instance without a subcategory. Anyway, the subcategories are NOT available in the HTML code so Webrat don't see it.

My question is: how can I write a functional test for this?. But also, how can I make this approach working without JavaScript?

A: 

We use Cucumber to test anything javascript. Instead of WebRat, we use Capybara. For any of the Javascript-dependent tests, we use Selenium, although Culerity/Celerity looks cool.

Preston Marshall