Testing the drag and drop function on rails 3

How do you simulate drag and drop functions from rspec query specs?

I have a #divItem element that I drag into the #divContainer (jquery) element. On page refresh, I want to make sure that the #divItem element is in the #divContainer element.

+4
source share
2 answers
it "should drag item to new list", :js => true do item = Item.create!(:title => "title 1", :group => "group 1") # verify that item is withing group 1 visit items_path within("#group 1") do # id of a div element (or ul element) page.should have_content("title 1") end item_element = find("##{item.id}") new_group_element = find("#group 2") item_element.drag_to new_group_element # verify that after page reload item is withing the new group visit items_path within("#group 2") do page.should have_content("title 1") end end 
+7
source

All Articles