Adds a helper method to your controller and integration tests that automatically opens the response body in the default browser.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib fixed Rails init bugs Jul 14, 2011
test fixed Rails init bugs Jul 14, 2011
.gitignore bumped gem version to 0.7.0 May 31, 2010
CHANGELOG initial commit Jun 29, 2009
MIT-LICENSE initial commit Jun 29, 2009
README updated README May 31, 2010
Rakefile converted lindo to jeweler Dec 4, 2009
VERSION Version bump to 1.0.0 Jul 14, 2011
lindo.gemspec fixed Rails init bugs Jul 14, 2011

README

= lindo

Enables rendering of the body of an HTTP response from inside controller and
integration tests. This makes it easy to diagnose problems when building
assert_select statements or just sanity check the output of the test.

== Installation
  
Install the gem standalone:

  sudo gem install lindo

Or install the gem in your Rails project:

  config.gem 'lindo' # add this line to environment.rb
  rake gems:install

You may have to require and extend the Lindo module from your test or
spec helper if you use sessions in your integration tests:

  require 'lindo'
  session.extend Lindo

== Usage

Insert the vr method in your functional test immediately after an HTTP
request has been sent:

  def test_new
    post :new
    vr
    assert_select "div[id=header]"
  end

vr attempts to open the response body in the default web browser. If you want
to open the raw HTML in the default text editor instead, simply pass the :html
symbol to the method:

  def test_new
    post :new
    vr(:html)
    ...
  end

By default, vr looks for an instance variable named @response and calls the #body
method on it. If your page body is stored in a different variable (such as when
testing a mailer) you can pass the raw HTML directly to vr and it will do the
right thing:

  def test_mailer
    mail = Mailer.create_notification
    vr(mail.body)
    ...
  end

== Compatibility

Lindo works with test/spec, test/unit, RSpec, and Cucumber. When testing with
RSpec, ensure your controllers are using integrate_views otherwise nothing will
show up when the browser opens. To use Lindo with Cucumber, a custom step can
be written. It could look something like this:

  Then /^render the current page$/ do
    extend Lindo
    vr
  end

== Running Unit Tests

Use the rake command to run the unit tests for the plugin. The tests require
that the Mocha gem be installed locally:

  sudo gem install mocha

== Resources

Repository: http://github.com/adeptware/lindo/
Blog: http://adeptware.com/blog
Author: Adeptware, Inc.