Know what makes your browser pant

I figure we needed a definitive reference for what work is triggered by changing various CSS properties. It's something I get asked about often enough by developers, and while we can do tests with DevTools, I have both the time and inclination to shortcut that for everyone. I'm nice like that. —Paul Lewis

How much should I refactor?

The Rails community has been abuzz with object-oriented programming, SOLID principles, laws, design patterns, and other principles, practices, and patterns. We’ve (re)discovered new tools and techniques to separate and reuse logic, making code easier to test, understand, and maintain. Now that we’ve learned about all these new tools, when do we use them?

New geordi script: migrate-all

Use the command geordi migrate to migrate your databases and to prepare them before running tests. The abbrevation geordi m works as well.

  • It will run rake db:migrate if parallel_tests does not exist in your Gemfile
  • Otherwise it runs b rake db:migrate and then executes b rake parallel:prepare if parallel_tests was found in your Gemfile.

Error during Rails 5 upgrade: Environment data not found in the schema

This error is raised because your old database does not have a configured environment yet, which Rails 5 enforces.

If this error occurs while migrating your parallel test databases, make sure to update the parallel_tests gem first: current versions fix this. If you're still using Cucumber < v3, the latest version of parallel_tests will be 2.18.0.

yujinakayama/transpec: The RSpec syntax converter

A comprehensive script to convert test suites from RSpec 2 to RSpec 3. This converts more than should/expect syntax.

httpbin: HTTP Client Testing Service

Some dozen generic API endpoints you can use to test how your HTTP client deals with various responses, e.g.

  • a slow connection
  • many redirects
  • compressed data

I found this useful while debugging an issue with timeouts.

Wrapping Your API In A Custom Ruby Gem

Nice tutorial about packaging Ruby bindings to your API in a Ruby gem, with tests using VCR casettes.

mattheworiordan/capybara-screenshot

Using this gem, whenever a Capybara test in Cucumber, Rspec or Minitest fails, the HTML for the failed page and a screenshot (when using capybara-webkit, Selenium or poltergeist) is saved into $APPLICATION_ROOT/tmp/capybara.

Link via Binärgewitter Podcast (German).

BrowserStack has browser plugins for local testing

Local testing allows you to test your private and internal servers using the BrowserStack cloud, which has support for firewalls, proxies and Active Directory.

Stubbing out external services with an embedded Sinatra application

One of many useful techniques when your test suite needs to talk to a remote API.

mattheworiordan/capybara-screenshot

Takes a screenshot when you call it, or when a test fails.

responsive.is

Online tool to test how a site behaves in popular desktop, tablet and phone resolutions.

colszowka/simplecov - GitHub

Code coverage for Ruby 1.9 with a powerful configuration library and automatic merging of coverage across test suites.

Note that rcov won't ever have support for Ruby 1.9, you're supposed to use rcov for 1.8 and simplecov for 1.9.

Cucumber.yml was found, but could not be parsed.

If you encounter the error message above when running cucumber, just execute...
rm rerun.txt
...in the Rails directory.

Or run...
tests
...from the geordi gem. This will do the work for you automatically.

ActiveSupport::StringInquirer

Wrapping a string in this class gives you a prettier way to test for equality.

plus2/whereuat - GitHub

Adds a slide out panel to your Rails application that directs clients to test stories that have been marked as 'delivered' in Pivotal Tracker.

Run a rake task in all environments

Use like this:

power-rake db:migrate VERSION=20100913132321

By default the environments development, test, cucumber and performance are considered. The script will not run rake on a production or staging environment.


This script is part of our geordi gem on github.

defunkt's fakefs at master - GitHub

A fake filesystem. Use it in your tests.

Railscheck project home page

This project is (or will be) a best effort semi-static verifier for your Ruby on Rails projects. Delivered as a Ruby gem it provides a shell command task "railscheck" that you can run against your Rails projects to test for a number of typical bugs, potential problems and inconsistencies.

Integrity | The easy and fun automated continuous integration server

Integrity is the angel watching over your shoulder while you code. As soon as you push your commits, it builds, runs your tests, and makes sure everything works fine.

mdub's sham_rack at master - GitHub

Or, you can test your Rack application (or Sinatra, or Rails, or Merb) using arbitrary HTTP client libraries, to check interoperability.

citrusbyte's contest at master - GitHub

Write declarative tests using nested contexts without performance penalties. Contest is less than 100 lines of code and gets the job done.

thumblemonks's riot at master - GitHub

Riot differs primarily in that it does not rerun setup for each test in a context.

Unit Testing Achievements

  • Unlock achievements for running your test suite!