-
Notifications
You must be signed in to change notification settings - Fork 1
Tipps and tricks
pas edited this page Oct 9, 2012
·
8 revisions
Sometimes you want to check if an exception is thrown. For that you can use assert_raise
assert_raise(RuntimeError) { #Code that should throw a RuntimeError }
setup is always called before a test starts and teardown when the test is finished. So you can write
@user
def setup
@user = Models::User.created(..data)
end
def teardown
@user.clear
end
def test1
#Do something with @user
end
Instead of
def test1
user = Models::User.created(..data)
#Do something with user
user.clear
end
# ... A lot of tests using a user ...
def test100
user = Models::User.created(..data)
#Do something with user
user.clear
end
Use java-script for that
<form action='/unregister' name='data' method='POST'></form>
<a href="javascript:data.submit()">Delete Account</a>
See our Menu for an example
Use
git log
to see commit and write down the hash on the top of the commit
commit 584f0c4b4704fb11a45cb8c1351cb33
Merge: ce32bd5 bdaa84e
Author: Pas <[email protected]>
Date: Mon Oct 8 12:29:42 2012 +0200
Merge branch 'master' of https://github.com/ese-unibe-ch/ese2012-team1
Then checkout the file
git checkout 584f0c4b4704fb11a45cb8c1351cb33 path/to/your/file.rb
And commit the retrieved file