Created
June 25, 2010 14:00
-
-
Save mike-burns/452881 to your computer and use it in GitHub Desktop.
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 'test_helper' | |
class PostsTest < ActionController::IntegrationTest | |
def updating_a_post_successfully | |
user = Factory(:user) | |
i_am_signed_in_as(user) | |
post = Factory(:post, :user => user) | |
go_to(edit_post_path(post)) | |
fill_in(:title, :with => 'Willard Scott') | |
press_button('Update') | |
assert_select '.flash', :text => 'Your post was updated successfully' | |
end | |
def updating_a_post_unsuccessfully | |
{:title => 'Awesome Post Name', :body => 'Awesome story'}.each do |field, value| | |
user = Factory(:user) | |
i_am_signed_in_as(user) | |
post = Factory(:post, :user => user) | |
go_to(edit_post_path(post)) | |
fill_in(field, :with => '') | |
press_button('Update') | |
assert_select '.flash', :text => 'Your post was updated successfully', :count => 0 | |
fill_in(field, :with => value) | |
press_button('Update') | |
assert_select '.flash', :text => 'Your post was updated successfully' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment