If you run specs or your application and get an error like: ActionController::MissingFile in 'ProductsController#show, should render PDF...

babushka.me

The idea is this: you take a job that you'd rather not do manually, and describe it to babushka...

A check if two date or time ranges A and B overlap needs to cover a lot of cases:

Sometimes it is useful to define a named scope by implementing a static method with the scope's name on...

makandra dev

Given group size If you would like to split a Ruby array into pairs of two, you can use the...

Then /^I should get a response with status (\d+)$/ do |status| response.status.should include(status) end Capybara Then /^I should...

This card describes a Cucumber step that lets you say: When I perform basic authentication as "username/password" and I visit...

When defining a trait using the Modularity gem, you must take extra steps to define constants to avoid caveats (like...

This is for those who already own an SSL certificate (e.g. using it in the Apache HTTP Server) and need...

Update: This trick probably isn't very useful anymore in Ruby 2.x. The Ruby GC has improved a lot...

justinfrench.com

If you’re testing the behavior of deprecated code in your Ruby project, the warning messages littered throughout your spec...

kernel.org

Git allows you to do a binary search across commits to hunt down the commit that introduced a bug.

These steps are now part of Spreewald. The step definitions below allow you to test the filename suggested by the...

The step definitions below allow you to write this in both Webrat and Capybara: When I follow "Download as PDF...

Our collection of the most useful Cucumber steps, Spreewald, now supports exact matching of form fields and lets you use...

In order to redirect all requests from redirecting-host.com to desired-host.com while keeping path and query params unchanged, change your Apache...

In RSpec 2 shared_examples_for can have parameters. You can simply hand over arguments from it_behaves...

When you need to see the content of a page (i.e. not all the HTML but the relevant text body...

You can usually just use the eq matched to compare two numbers: expect(deal.total).to eq(120)

You can use these step definitions: Then /^I should not see an error$/ do (200 .. 399).should include(page.status_code...

When you eagerly load an association list using the .include option, and at the same time have a .where on...

RSpec 1, RSpec 2 To test whether two arrays have the same elements regardless of order, RSpec 1 and 2...

Deadlocks only occur if two transactions in separate threads compete for the same rows in the database. They usually (but...

If your controller spec never reaches your controller code: Make sure you are signed in. Make sure you are actually...