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...

github.com

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

makandra dev

There are two distinct ways of commenting Haml markup: HTML and Ruby. HTML comments This will create an HTML comment...

makandra dev

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...

makandra dev

Update RubyGems and Passenger Bundler requires Rubygems >= 1.3.6. Run gem update --system if you have an older version.

github.com

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...

regular-expressions.info

You can write regular expressions some different ways, e.g. /regex/ and %r{regex}. For examples, look here. Remember that it...

github.com

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...

github.com

An alternative to this technique is using VCR. VCR allows you to record and replay real HTTP responses, saving you...

Until May 2011 our gems have been created with Jeweler, which is a helper library to package code into a...

With defaults, RCov doesn't work the way you how you would like it to. To create a nice test...

github.com

We built cucumber_spinner to have a progress bar for Cucumber features, which also outputs failing scenarios as soon as...

makandra dev

rspec_spinner is a progress bar for RSpec which outputs failing examples as they happen (instead of all at the...

Install gem and plugin sudo gem install parallel script/plugin install git://github.com/grosser/parallel_tests.git Adapt config/database.yml test: database: xxx_test<%= ENV...

When you need to patch an existing gem, one way is to "vendor" the gem by copying it into the...

sudo apt-get install unzip rake rails:freeze:edge RELEASE=2.2.2

To run a single test file: rake test:units TEST=test/unit/post_test.rb rake test:functionals TEST=test/functional/posts_controller_test.rb rake test:integration TEST...