Skip to content

Instantly share code, notes, and snippets.

@ktec
Created January 12, 2010 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ktec/275616 to your computer and use it in GitHub Desktop.
Save ktec/275616 to your computer and use it in GitHub Desktop.
require 'test_helper'
class AccountControllerTest < ActionController::TestCase
context 'GET to edit for existing account' do
setup do
@account = Factory(:account)
Account.stubs(:find).returns(@account)
get :edit, :id => @account.to_param
end
should 'find account' do
assert @account.valid?, @account.errors
end
should_render_template :edit
should_respond_with :success
end
context 'PUT to update for existing account' do
setup do
@account = Factory(:account)
put :update, :id => @account.to_param,
:account => Factory.attributes_for(:account)
end
should_set_the_flash_to /updated/i
should_redirect_to('accounts edit') { edit_account_path }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment