Skip to content

Instantly share code, notes, and snippets.

@brandon-beacher
Created April 16, 2012 20:50
Show Gist options
  • Save brandon-beacher/2401426 to your computer and use it in GitHub Desktop.
Save brandon-beacher/2401426 to your computer and use it in GitHub Desktop.
it "should sort chapters" do
overview_activity = create(:overview_activity)
first_chapter = create(:chapter,
activity: overview_activity,
position: 1,
title: "First Chapter")
second_chapter = create(:chapter,
activity: overview_activity,
position: 2,
title: "Second Chapter")
visit edit_activity_path(overview_activity)
chapters_before = page.all('.chapter .handle')
chapters_before.first.text.must_include "First Chapter"
chapters_before.second.text.must_include "Second Chapter"
chapters_before.second.drag_to(chapters_before.first)
chapters_after = page.all('.chapter .handle')
chapters_after.first.text.must_include "Second Chapter"
chapters_after.second.text.must_include "First Chapter"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment