Skip to content

Instantly share code, notes, and snippets.

@mateuslinhares
Created August 12, 2011 16:31
Show Gist options
  • Save mateuslinhares/1142413 to your computer and use it in GitHub Desktop.
Save mateuslinhares/1142413 to your computer and use it in GitHub Desktop.
example using capybara and capybara-webkit
require 'spec_helper'
feature "Rating" do
let(:current_user){ Factory(:user) }
let(:post){ Factory(:post) }
let!(:comment){ Factory(:comment, :commentable => post) }
background do
sign_in_as(current_user)
end
scenario 'rating a comment', :js => true do
visit post_path(post)
within('.rating') do
page.should have_link "thumbs_up"
page.should have_content "0"
end
click_link 'thumbs_up'
wait_until{ page.has_no_selector?(:spinning) }
within('.rating') do
page.should_not have_link "thumbs_up"
page.should have_content "1"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment