Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pelargir-vizres

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pelargir-vizres

  • 0.5
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= vizres

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

== Installation

vizres uses git for source control. You can install the gem directly:

gem sources -a http://gems.github.com (you only have to do this once) sudo gem install pelargir-vizres

Or clone the project:

git clone git://github.com/pelargir/vizres.git vendor/plugins/vizres

To use with a Rails 2.1 app, edit the environment.rb file and add an entry for the gem to the Rails::Initializer config block.

== 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

Note that to use the default web view, your Rails application must be running locally on port 3000. This will ensure that the page renders correctly with the appropriate images and stylesheets. The server doesn't need to be running if you use the HTML-only view.

== Compatibility

vizres requires OS X. Support for Windows is planned.

test/spec and test/unit work fine with vizres. RSpec, however, tests views independently of controllers, so vizres won't work with it.

If Subversion is installed and accessible on the command line, the temporary files generated by vizres will automatically be marked and ignored by Subversion on check-in.

== 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/pelargir/vizres/ Blog: http://matthewbass.com Author: Matthew Bass

FAQs

Package last updated on 10 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc