-
Notifications
You must be signed in to change notification settings - Fork 1
Tipps and tricks
Sometimes you want to remove your branch on github.com. For that you can use:
git push origin :name_of_your_branch
Some gems can't be installed on Windows without the DevKit.
-
Go to http://rubyinstaller.org/downloads/ and install the DeveloptmentKit: "DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe"
-
Double click and extract the file to the path you want
-
Change in commandline into the directory you installed it and use
ruby dk.rb init ruby dk.rb install
For more information an troubleshooting see here: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
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
use the follwing code:
begin
critical command
rescue
redirect "/error/ERRORCODE"
end
in file sites.rb look for
get '/error/:title' do
add another if-block for the new error code with error message. e.g.
if params[:title] == "ERRORCODE"
msg = "ERRORCODE depending message"
end