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...
When a has_many association basically serves to store a list of associated strings (tags, categories, ...), it can be convenient...
When you just went through a long debug-fest and infested your code with dozens of debug messages, it can...
Don't insert table rows in a Rails database migration. This will break tests that expect that database to be...
Occasionally some complex query must be processed on the database because building thousands of Ruby objects is impracticable.
In order to go back one page in your Cucumber tests, you can use the following step definition for Capybara...
Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the...
This step tests whether a given select option comes preselected in the HTML. There is another step to test that...
For clarity and traceability, your commit messages should include the ID and title of the Pivotal Tracker story you're...
The following initializer provides an :alias => "my_route_name" option to restful routes in your route.rb. This simply makes the...
This note describes a Cucumber step definition that lets you test whether or not a CSS selector is present on...
Ctrl + R Search commands you entered previously. Press Ctrl + R again to search further back, Ctrl + Shift + R searches forward...
Sometimes you inherit a non Rails or non Rack based web app such as PHP, Perl, Java / JEE, etc. I...
If a controller action responds to other formats than HTML (XML, PDF, Excel, JSON, ...), you can reach that code in...