Git Product home page Git Product logo

guard-test's Introduction

Guard::Test

Guard::Test allows to automatically & intelligently launch tests when files are modified or created.

Compatibility

  • Compatible with Test::Unit 2.1.1.

  • Tested on Ruby 1.8.6, 1.8.7, REE & 1.9.2.

Install

Please be sure to have guard installed before continue.

Install the gem:

gem install guard-test

Add it to your Gemfile (inside test group):

gem 'guard-test'

Add guard definition to your Guardfile by running this command:

guard init test

Usage

Please read guard usage doc.

Guardfile

Guard::Test can be adapted to many kind of projects. Please read guard doc for more info about Guardfile DSL.

Standard Ruby project

guard 'test' do
  watch('^lib/(.*)\.rb')        { |m| "test/lib/#{m[1]}_test.rb" }
  watch('^test/(.*)_test.rb')   
  watch('^test/test_helper.rb') { "test" }
end

Ruby On Rails project

guard 'test' do
  watch('^app/models/(.*)\.rb')                       { |m| "test/unit/#{m[1]}_test.rb" }
  watch('^app/controllers/(.*)\.rb')                  { |m| "test/functional/#{m[1]}_test.rb" }
  watch('^app/controllers/application_controller.rb') { "test/functional" }
  watch('^app/controllers/application_controller.rb') { "test/integration" }
  watch('^app/views/(.*)\.rb')                        { "test/integration" }
  watch('^lib/(.*)\.rb')                              { |m| "test/lib/#{m[1]}_test.rb" }
  watch('^test/(.*)_test.rb')
  watch('^test/factories.rb')                         { "test/unit" }
  watch('^test/test_helper.rb')                       { "test" }
end

Options

Guard::Test allows you to choose between two different runners (Guard::Test’s runners are inherited from Test::Unit’s console runner):

  • 'default': Display tests results as they happen, with different chars (‘.’ for pass, ‘F’ for fail, ‘E’ for error) and print failures/errors messages & backtraces when all the tests are finished. Obviously, this is the guard-test default.

  • 'fastfail': Display tests results as they happen and print failures/errors messages & backtraces immediately.

Set the desired runner by passing the :runner option to the guard method:

guard 'test', :runner => 'fastfail' do
  ...
end

Development

Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.

Author

Rémy Coutable

Kudo

Many thanks to Thibaud Guillaume-Gentil for creating the excellent Guard gem.

guard-test's People

Stargazers

 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.