GithubHelp home page GithubHelp logo

ahdinosaur / vim-spec Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joshuavial/vim-spec

0.0 3.0 0.0 103 KB

Run Rspec or Mocha from Vim

License: MIT License

Shell 9.45% AppleScript 4.56% Vim Script 85.99%

vim-spec's Introduction

vim-spec

Spec runner for Vim. Run Rspec and Mocha tests straight from Vim.

Inspired by thoughtbot/vim-rspec and geekjuice/vim-mocha.

A hacked-up marriage between vim-rspec and vim-mocha. Determines whether to run Mocha or Rspec based on the spec's filetype. Allows for the same mapping to be used for all tests.

Example: Calling <leader>t in a Javascript file will call mocha. The same mapping can be used in a Coffeescript file and call mocha with the Coffeescript compiler. And of course, calling it from a Ruby file will invoke rspec.

Only need Mocha? Take a look at vim-mocha!

Installation

Using vundle:

Bundle 'geekjuice/vim-spec'

If using zsh on OS X it may be necessary to run move /etc/zshenv to /etc/zshrc.

Using pathogen

cd ~/.vim/bundle
git clone git://github.com/geekjuice/vim-spec.git

Example of key mappings

map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>

Configuration

Like thoughtbot/vim-rspec, the following variables can be overwritten for custom spec commands:

  • g:rspec_command
  • g:mocha_js_command
  • g:mocha_coffee_command

Examples:

let g:rspec_command = "!rspec --drb {spec}"
let g:mocha_js_command = "!mocha --recursive --no-colors {spec}"
let g:mocha_coffee_command = "!mocha -b --compilers coffee:coffee-script{spec}"

" Using test runners
let g:rspec_command = "Dispatch zeus rspec {spec}"
let g:mocha_coffee_command = "!cortado {spec}" "See geekjuice/vim-mocha

Notes/Issues

  • Default spec command fallbacks to the dominant spec filetype i.e. Ruby, JS, Coffee in the current directory. Future update will look for {spec|test} directories rather than search the whole parent tree

  • Assertions with no name i.e. no attribute for it in mocha will fail if trying to call nearest test RunNearestSpec as it depends on it having a value

Credits

thoughtbot/vim-rspec

geekjuice/vim-mocha

License

vim-spec is released under the MIT License.

vim-spec's People

Contributors

geekjuice avatar joshuavial avatar

Watchers

Mikey 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.