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
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...
Our gem Mail Magnet allows you to override e-mail recipients in ActionMailer so all mails go to a given...
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...
def task_with_hoptoad_notification(options) task(options) do begin yield rescue Exception => e Airbrake.notify(e) raise e
Update RubyGems and Passenger Bundler requires Rubygems >= 1.3.6. Run gem update --system if you have an older version.
Sometimes you want to fetch associations for an ActiveRecord that you already loaded, e.g. when it has deeply nested associations...
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:
Spreewald has steps that let you test that e-mails have been sent, using arbitrary conditions in any combination.
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...
The following example is from the Cucumber wiki: Given a blog post named "Random" with Markdown body """ Some Title, Eh...
Our awesome collection of rspec helpers (formerly known as "spec_candy.rb") is now available as a gem. It works, it is...
An alternative to this technique is using VCR. VCR allows you to record and replay real HTTP responses, saving you...
This will tunnel HTTP requests to one given domain and port through an intermediary SSH server: ssh -L 8080:targethost...
For example, to send a form and populate a preview div with the response. $('content_form').request({ parameters: { 'preview': "1...
When a Cucumber feature leaves your page through an external Link, Webrat has problems like "Could not find field: "E...
This may be awkward to set up, but will work once you're done. Fun facts:
Most of these will not work in newer projects because these use the Capybara/Rack::Test combo in lieu of Webrat...
With defaults, RCov doesn't work the way you how you would like it to. To create a nice test...