Life In The Stack Trace...

TODO: <Insert clever marketing phrase here>

Duck Test On The Mac


This is basically the same as my original blog post Duck Test Quick Start. The only difference is that I am running it on a Mac. I love the Mac. I wish I could afford one.

Quick start

Create a new rails app named

rails new --skip-bundle

Edit and add the following to your test group

group :test do
  # ... existing gems
  gem 'turn', :require => false
  gem 'duck_test'

Run bundle

bundle install

Generate a scaffold with some tests, then, migrate and prepare the test environment

rails g scaffold book author:string title:string
rake db:migrate
rake test:prepare

Run the Rails console

rails c test

Edit one of the test files: test/unit/book_test.rb

require 'test_helper'
class BookTest < ActiveSupport::TestCase
  test "the truth" do
    assert false

Look at the Rails console and you should see that the test automagically ran and failed. Go back and change the assert from false to true and save. The test should run again and pass.

To see it in action, have a look at the following video: