When using state_machine you sometimes need to know whether an object may execute a certain transition. Let's take...

By default, Rails views escape HTML in any strings you insert. If you want to insert HTML verbatim, you need...

danhixon.github.com

If you encounter the error message above when running cucumber, just execute... rm rerun.txt ...in the Rails directory.

To show the collation of your tables you have to login to the MySQL console and execute SHOW TABLE STATUS...

The Rails logger will store its content in a buffer and write it into the file system every 1000 lines...

When your Cucumber feature seems to forget cookies / sessions when you run it with Selenium check if the test travels...

github.com

Looks simpler than inaction_mailer: gem install mailcatcher mailcatcher Setup Rails to send mails to 127.0.0.1:1025. Usually you want...

Defining a custom to_json method for your classes can be useful. Do it properly or you will "randomly" get...

makandra dev

Never use raise_error without specifying the Error you expect. expect { do_a_lot_of_complicated_stuff }.to raise_error...

You can use the step definition below to say this: Then the "Last name" field should have an error

makandra dev
blog.rubybestpractices.com

class Errormaster CoffeeIsOut = Class.new(StandardError) # is prettier than class CoffeeIsOut < StandardError; end end Reference such an error class with Errormaster...

Whenever Firefox updates, all your Cucumber features that use Selenium break. This is annoying. In order to remedy this, version...

There is a bug in Rails 3's dbconsole script, which makes the following command open a database console for...

Simple: Tell the application controller how to handle exceptions, here a RecordNotFound error. Do this with the following line: # application_controller.rb...

While it might seem trivial to implement an invoice that sums up items and shows net, gross and vat totals...

Rails doesn't know which host it is running on. For generating links, it strips the hostname off the request...

Note that if you plan to downgrade Firefox because your Selenium tests broke after a Firefox upgrade, there is a...

Note that if you plan to freeze your Firefox versions because your Selenium tests break whenever Firefox updates, there is...

Detecting if a Javascript is running under Selenium WebDriver is super-painful. It's much easier to detect the current...

tl;dr: Always have your attachment path start with :rails_root/storage/#{Rails.env}#{ENV['RAILS_TEST_NUMBER']}/. The directory where you...

Don't simply test for the presence of the magic Paperclip attribute, it will return a paperclip Attachment object and...

paperplanes.de

This post is not about devops, it's not about lean startups, it's not about web scale, it's...

This is now part of geordi. Please don't follow the instructions below, if you use geordi. Inspired by the...

When you have a program running in a hidden X screen (like with Xvfb for Selenium tests) you may want...