Created
November 5, 2009 15:15
-
-
Save plukevdh/227106 to your computer and use it in GitHub Desktop.
Quick unit test customer safety. This way I'm not overwriting data by accident.
This file contains 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
def setup | |
@cus_save = Customer.find("####") | |
login | |
end | |
def teardown | |
cus = Customer.find "####" | |
cus.attributes = @cus_save.attributes | |
assert cus.save! | |
end | |
def login | |
post_via_redirect "authenticate/login", :username => @cus_save[:cus_login], :password => @cus_save[:cus_password] | |
assert_equal "/", path | |
assert_equal @cus_save.id, session[:id] | |
get_via_redirect "customer/update_info" | |
assert_equal "/customer/update_info", path | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment