Created
August 12, 2011 16:31
-
-
Save mateuslinhares/1142413 to your computer and use it in GitHub Desktop.
example using capybara and capybara-webkit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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