‹ jan0sch.de

Tags / Software

Page 8


When testing has_and_belongs_to_many models using rspec and factory girl you should setup your factory the following way:

If you run MySQL you probably use the innodb storage engine because it provides a number of advantages over MyIsam.

The official documentation recommends giving 50-80% of your ram to innodb_buffer_pool_size which can easily go above 10 gb because ram is cheap nowadays. The same documentation recommends settings innodb_log_file_size to 25% of innodb_buffer_pool_size meaning this can easily be 2 or more gb.

If you experience the error message bind: permission denied when you try to run Sylpheed on FreeBSD you most likely have the false permissions for /tmp and/or /var/tmp.

If you are using heroku you probably ran into some issues with rake assets:precompile. When using active admin bringing it’s assets into your app can also be quite tricky.

The method of precompiling your assets yourself and adding them to your git repository works for sure but it isn’t really best practice.

Another way to get the needed assets to be compiled is as follows:

If you’re using cucumber you should be carefully examining your tests to make sure you’re really writing acceptance tests and not integration tests.

If you want to use another test framework for rails like rspec and factories instead of fixtures. You should adapt config/application.rb as follows:

Sometimes you’ll want or have to split a git repository into two. This is usually a sign of not thinking forward enough but hey sh.. happens. If your repository is structured in a way that you just need a subdirectory of it into a new repository you can follow the steps below.

If you are using lighttpd as webserver and host drupal websites you probably have used some lua script and mod_magnet to get clean urls. Recent versions of lighttpd (1.4.26+) are able to handle rewrites better through the url.rewrite-if-not-file command. The config for your [virtual] server should look like this:

To write unit tests for your javascript code you can use a testing framework like JSTestDriver which is able to run under TeamCity.

Usage and configuration instructions for JSTestDriver are available on their website. For integration with TeamCity you’ll have to write an ant build file. But to be able to run browsers on your build agent machine you’ll have to use Xvfb. The test task in your ant file should look like the one below:

The annoying thing about Drupal’s tests is that they seem to be optimized for running them manually which is insane in my opinion. Using some hacks it is possible to run them under TeamCity.

Sometimes you’ll want to remove all ruby gems from your system. This is very easy (at least under unix like operating systems). Just issue the following command:

« ältere Beiträge neuere Beiträge »