Giter Site home page Giter Site logo

spectator's Introduction

Spectator

Code Climate

Test driven development red-green cycle for simple people!

The gist

Spectator is a simple watcher for your specs:

  • it will execute a spec each time a file (spec or implementation) is modified or created (really catches new files!)
  • it does not starts your whole suite at start, nor when a spec passes or fails (as autospec tends to do)
  • if you ask it runs the whole spec suite

Started as a custom Watchr script Spectator has grown up to a tiny gem!

Compatibility

Works with RSpec-1 and RSpec-2 (looks for a .rspec file in the project root).

Usage

Launch spectator in a terminal and go back to code!

The normal behavior is similar to autotest --fast-start --no-full-after-failed but gives the user a bit more control over execution. By hitting CTRL+C (or CMD+. on OSX) you get the following prompt:

^C (Interrupted with CTRL+C)
--- What to do now? (q=quit, a=all-specs):

Type q and ENTER (or CTRL+C again) to quit.

Type a and ENTER (or CTRL+C again) to execute the whole suite of specs.

Advanced Configuration

If you want to override some path matching:

BASE_DIR_REGEXP:

The glob that expanded will list the directories that contains the code. Default:

SPEC_DIR_REGEXP:

The glob that expanded will list the directories that contains the specs. Default:

RSPEC_COMMAND:

The full command that will run your specs. Default: bundle exec rspec (or bundle exec spec for RSpec 1.x)

Examples

Inline ENV variables

# this will match lib/opal/parser.rb to spec/cli/parser.rb
BASE_DIR_REGEXP='lib/opal' SPEC_DIR_REGEXP='spec/cli' spectator

Exported ENV variables

BASE_DIR_REGEXP: '(?:opal/corelib|stdlib|spec)'
SPEC_DIR_REGEXP: '(?:spec/corelib/core|spec/stdlib/\w+/spec)'
RSPEC_COMMAND: 'bundle exec ./bin/opal-mspec'
spectator

With a .spectator.rb script file

This file can be present in each project folder or in your home directory if you want to share general settings. When files are present in both folders the one in the home directory will be loaded first.

# contents of ".spectator.rb" file

ENV['BASE_DIR_REGEXP']  = '(?:opal/corelib|stdlib|spec)'
ENV['SPEC_DIR_REGEXP:'] = '(?:spec/corelib/core|spec/stdlib/\w+/spec)'
ENV['RSPEC_COMMAND']    = 'bundle exec ./bin/opal-mspec'

require 'spectator/success_notifier'

module Spectator
  class SuccessNotifier
    def notify(success)
      fork { exec "say #{say_message(success)}" }
      super
    end

    def say_message(success)
      success ? 'All right' : 'Ouch'
    end
  end
end

License

Copyright © 2011-2014 Elia Schito, released under the MIT license

spectator's People

Contributors

elia avatar spaghetticode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spectator's Issues

fssm is dead

You always get this message because fss seems to be dead.

Dear developers making use of FSSM in your projects,
FSSM is essentially dead at this point. Further development will
be taking place in the new shared guard/listen project. Please
let us know if you need help transitioning! ^_^b
- Travis Tilley

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.