In /etc/crontab In /etc/cron.d/* In /etc/cron.hourly/* In /etc/cron.daily/* In /etc/cron.weekly/* In /etc/cron.monthly/* In the personal crontab of any user. This...
You can use record.send(:update_without_callbacks) or record.send(:create_without_callbacks) This can be used as a...
With its you can switch the subject of an example to a method value of the current subject: describe Array...
Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']) or a hash (:conditions => { 'state' => 'draft...
To only run a single describe/context block in a long spec, you can say spec spec/models/note_spec.rb:545 ... where the describe...
If you need to find all files inside a directory that were modified in the last 24 hours you can...
This will show you how to create a RSS feed that the Feed Validator considers valid. Note that RSS is...
You should test the callback methods and its correct invocation in two separate tests. Understand the ActiveRecord note before you...
Expiration of Rails sessions By default Rails sessions expire when the user closes her browser window. To change this edit...
When a spec only runs when it is called directly, but not as part of the whole test suite, make...
By default, Cucumber uses mocha. This note shows to use RSpec stubs and mocks instead. Rspec 1 / Rails 2
Call with the server's hostname (and user if you have no SSH agent), e.g. install-gems-remotely my.server.com
There are two distinct ways of commenting Haml markup: HTML and Ruby. HTML comments This will create an HTML comment...
This is an awesome gadget in your toolbox, even if your test coverage is great. gem install ruby-debug (Ruby...
This raises "Could not find first Keyword": describe Keyword do it { should validate_uniqueness_of(:text) } end Do this instead...
There will probably be better solutions as we become more experienced with using Bundler, and more command line tools become...
Update RubyGems and Passenger Bundler requires Rubygems >= 1.3.6. Run gem update --system if you have an older version.
There are three ways to define your own RSpec matchers, with increasing complexibility and options: 1) Use RSpec::Matchers.define
When you roll custom URLs with hacks like routing-filter, you can put a spec like this into spec/routing/routing_spec.rb:
Don't use should validate_format_of(...) because that matcher works in weird ways. Use the allow_value matcher instead...
You can write regular expressions some different ways, e.g. /regex/ and %r{regex}. For examples, look here. Remember that it...
Our awesome collection of rspec helpers (formerly known as "spec_candy.rb") is now available as a gem. It works, it is...
To delete a local branch git branch -d the_local_branch To remove a remote branch (if you know what...
An alternative to this technique is using VCR. VCR allows you to record and replay real HTTP responses, saving you...