GithubHelp home page GithubHelp logo

xithan / wagn-rspec-formatter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ged/rspec-formatter-webkit

0.0 3.0 0.0 483 KB

A webkit-aware pretty formatter for RSpec (github mirror).

Home Page: http://deveiate.org/webkit-rspec-formatter.html

License: BSD 3-Clause "New" or "Revised" License

Ruby 59.67% CSS 7.90% JavaScript 14.52% Shell 1.51% HTML 16.41%

wagn-rspec-formatter's Introduction

Wagn RSpec Formatter

This is forked from webkit-rspec-formatter and adds some hacks to make the output more fun for Wagn specs.

Description of the original gem

This is a formatter for RSpec 2 that takes advantage of features in WebKit to make the output from RSpec in Textmate more fun.

Test output looks like this:

Installation

To get started, install the ‘rspec-formatter-webkit` gem:

$ gem install rspec-formatter-webkit

Usage

If you’re running specs in Textmate 2 via the RSpec bundle, include these in your .tm_properties file:

TM_RSPEC_OPTS      = '-rrspec/core/formatters/webkit'
TM_RSPEC_FORMATTER = 'RSpec::Core::Formatters::WebKit'

To do the same in TextMate 1, open the ‘Advanced’ Preferences and adding the same variables there:

That’s it!

Logging Output

If you have some kind of log output that you’d like to show up underneath the example, you can append lines of HTML to the logger-output thread-local variable and they’ll be inserted into a div under the example line that can be toggled open and closed by clicking the example line:

Thread.current['logger-output'] << %{<p>Some stuff happened.</p>}

Each line that has such logging appended will appear with an asterisk after it in the output.

Loggability

If you’re using Loggability for logging, the WebKit formatter has CSS rules for the output of its HTML formatter, and includes a helper for injecting the logs generated for an example into the output. Just include the Loggability spec helper in your RSpec config:

require 'rspec'
require 'loggability/spechelpers'

RSpec.configure do |config|
    config.include( Loggability::SpecHelpers )
end

Miscellaneous

This formatter is also usable anywhere else the standard HTML formatter is, of course. Also, while it’s specifically intended to be used under the Textmate HTML viewer that the RSpec bundle uses, the output should work fine under recent Gecko/Firefox-based viewers, as well.

Patches/suggestions welcomed.

Contributing

You can check out the current development source with Mercurial via its project page. Or if you prefer Git, via its Github mirror.

After checking out the source, run:

$ rake newb

This task will install any missing dependencies and generate the API documentation.

License

Copyright © 2009-2014, Michael Granger All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the author/s, nor the names of the project’s contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

wagn-rspec-formatter's People

Contributors

ged avatar xithan avatar jasonm23 avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.