Giter VIP home page Giter VIP logo

vim-rspec's Introduction

vim-rspec

ABOUT

Beautiful, colorized RSpec tests in Vim with direct access to the line where the error occurred.

GreenScreenshot

HISTORY

INSTALL

  • Requires: gem install hpricot
  • Install with pathogen: clone/submodule into vim/bundle
  • rbenv users will need to install hpricot using system ruby RBENV_VERSION=system sudo gem install hpricot

USAGE

  • :RunSpec for current file
  • :RunSpecLine for current line (current 'it' block)
  • :RunSpecs for all files in spec dir
  • A split will open vertically on the right (if you prefer vertical, let g:RspecSplitHorizontal=0)
  • You can hit 'n' to go to the next error, or navigate to it and hit Enter to go to the line in the file.

Enhancements

  • Run rspec on current line (execute a single 'it' block)
  • Failures and Success is now displayed prominently at the top in green or red
  • Improved colors (for Solarized, specifically)
  • Run in same window, do not create a new window for every run
  • When browsing errors in rspec window, hitting enter takes you to the code in other split (do not create new window)
  • Ability to hit 'n' in the rspec output to go to the next error (and the corresponding code in the split)
  • Unescape html so that brackets in stacktraces are correctly displayed
  • Took out xslt support to focus the project on a ruby-based formatter
  • Default to horizontal split, use "let g:RspecSplitHorizontal=0" in vimrc to split vertical
  • Support for RSpec1 and RSpec2 (@thenoseman)
  • Automatically find the window with the spec (@thenoseman)

Suggested Key Mappings

By default you get these keymappings. If you don't want them, turn them off with:

let g:RspecKeymap=0

Run using Cmd-Shift-R:

map <D-R> :RunSpec<cr>

Run on current line (current 'it' block) Cmd-Shift-L:

map <D-L> :RunSpecLine<cr>

TODO

  • Further refactoring to improve maintainability
  • Custom paths for RunSpecs (e.g. fast_specs dir)
  • Support for other testing frameworks (test/unit, shoulda), maybe

NOTE: This version is drastically different from the original taq/vim-rspec fork due to a large refactoring of the main codebase into a modularized form. If you have an old fork with custom changes, you may want to look at what's been done here.

vim-rspec's People

Contributors

bogdan avatar dhruvasagar avatar etothepiipower avatar jonuts avatar justinlove avatar skwp avatar taq avatar thenoseman avatar vlmonk avatar yogan avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

vim-rspec's Issues

duplicated output appears

it seems like there's some weirdly cached/duplicated output at the end of the vim buffer. this output does not appear on command line running the spec, so it looks like a vim artifact. it seems to be from an old buffer somewhere but when I do a buffer list it's empty. needs further investigation. essentially looks like tests ran twice

Test report for an almost empty spec file displays '3 passed'

Environment

  • vim-rspec version: last available one (cf7eb2f)
  • rspec version: 3.2.3
  • vim version: NVIM 0.0.0-alpha+201504141749 (compiled Apr 15 2015 11:57:57)

Description

Let's imagine I'm using an almost empty file like so:

class Foo
  def answer
    42
  end
end

describe Foo do
  describe '#answer' do
  end
end

When executing :RunSpec on the file, the result is:


+-- 3 passed --------------------------------------------------
Finished in 0.00015 seconds

Damn !?! 3 tests passed ? where does that come from ?
Let's expand the result report:


++++++++++++++++++++++++++++++
+ PASS: All 0 Specs Pass!
++++++++++++++++++++++++++++++
Finished in 0.00015 seconds

Seems like 3 lines -> 3 passed

RunSpec, cant see errors

When i run Spec or SpecLine I cant see errors o which specs passed.

My gem list:

rspec (2.8.0, 2.7.0, 2.6.0)
rspec-core (2.8.0, 2.7.1, 2.6.4)
rspec-expectations (2.8.0, 2.7.0, 2.6.0)
rspec-mocks (2.8.0, 2.7.0, 2.6.0)
rspec-rails (2.8.1, 2.7.0, 2.6.1)
ruby-debug-base19 (0.11.25)
ruby-debug19 (0.11.6)
hpricot (0.8.6, 0.8.5, 0.8.4)

Failure output not shown

Any idea why failure output is not shown?

My output:

--------------------------------------------
  FAIL: 2 PASS: 1 PENDING: 0
--------------------------------------------

Finished in blah seconcds

[SearhcesController]

[GET show]

You need the hpricot gem to run this script.

Hey guys!

I'm trying to run RunSpec command, but I'm getting You need the hpricot gem to run this script.

spec/models/experience_spec.rb[Rails]                                                                                                                                    1,1/13 All
:RunSpec
RunSpec      RunSpecLine  RunSpecs
You need the hpricot gem to run this script.
Press ENTER or type command to continue

I have Hpricot installed

» irb
irb(main):001:0> require 'hpricot'
=> true
irb(main):002:0> 

I don't know what is happening.

My environment

  • rbenv
  • ruby 1.9.2-p290
  • on-my-zsh

Is it a known problem? Maybe my environment, something that I need to configure into zsh?

Quotes escaped

If I have a spec like it { should_not allow_value("a random value").for(:status_client) } it ends up like:

RunSpecLine does not work

On ubuntu 16.04 map <D-L> :RunSpecLine<cr> doesn't work.

Tried also nnoremap <leader>l :RunSpecLine<CR> but it doesn't work either.

invalid option: -l
Please use --help for a listing of valid options

RVM support

I get this error when I run :RunSpec from vim:

/Users/lyahdav/.rvm/gems/ruby-2.1.4/gems/bundler-1.10.6/lib/bundler/definition.rb:412:in `validate_ruby!': Your Ruby version is 2.0.0, but your Gemfile specified 2.1.4 (Bundler::RubyVersionMismatch)

My default RVM ruby is 2.1.4 (as is the .ruby-version in the directory I start vim from).
My system ruby is 2.0.0 (OS X default).

RunSpecs

so I added:

" Cmd-Shift-F for ALL RSpecs
nmap <D-F> :RunSpecs<CR>

but when I run it I get:

The run rspec file and line work just fine.....

run in background / feed output into ConqueTerm

I don't know if this is possible, but what would be fantastic is to run the rspecs in the background so that you can continue editing your files. At the moment vim is completely blocked while the tests are executing.

Hpricot Segmentation Fault

When running :RunSpec with Ruby 1.9.3 installed through RVM, with a newly compiled vim I get a segmentation fault:

/Users/furd/.rvm/gems/ruby-1.9.3-p0-falcon/gems/hpricot-0.8.6/lib/hpricot_scan.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]

Any idea why this is?

Segmentation fault

When I run :RunSpec, I got this error:

~/.rvm/gems/ruby-2.1.1/gems/hpricot-0.8.6/lib/hpricot_scan.bundle: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   the more detail of.

-- Control frame information -----------------------------------------------
c:0009 p:-17528657711240 s:0040 e:000039 TOP    [FINISH]
c:0008 p:---- s:0038 e:000037 CFUNC  :require
c:0007 p:0073 s:0034 e:000033 METHOD /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45
c:0006 p:0018 s:0024 e:000023 TOP    ~/.rvm/gems/ruby-2.1.1/gems/hpricot-0.8.6/lib/hpricot.rb:20 [FINISH]
c:0005 p:---- s:0022 e:000021 CFUNC  :require
c:0004 p:0059 s:0018 e:000017 BLOCK  /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110
c:0003 p:0286 s:0015 e:000014 METHOD /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35
c:0002 p:0015 s:0005 E:002430 EVAL   ~/.vim/bundle/vim-rspec/plugin/vim-rspec.rb:3 [FINISH]
c:0001 p:0000 s:0002 E:000278 TOP    [FINISH]

~/.vim/bundle/vim-rspec/plugin/vim-rspec.rb:3:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
~/.rvm/gems/ruby-2.1.1/gems/hpricot-0.8.6/lib/hpricot.rb:20:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'

-- C level backtrace information -------------------------------------------

-- Other runtime information -----------------------------------------------

* Loaded script: ~/.vim/bundle/vim-rspec/plugin/vim-rspec.rb

* Loaded features:

    0 enumerator.so
    1 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/enc/encdb.bundle
    2 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/enc/trans/transdb.bundle
    3 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb
    4 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/compatibility.rb
    5 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/defaults.rb
    6 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/deprecate.rb
    7 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/errors.rb
    8 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/version.rb
    9 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/requirement.rb
   10 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/platform.rb
   11 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb
   12 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/exceptions.rb
   13 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb
   14 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb
   15 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb
   16 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/path_support.rb
   17 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Errors are not displayed

I just updated my janus installation with this plugin (replacing the old vim-rspec), and while it runs and displays results, no red/green steps are displayed…

I have the header that is correct (fail, pass, pending), the time it took to run and the titles for contexts/describes. But nothing for actual steps.

At first, I thought it was because I didn’f force format to html in options, but it does not work either.

Any idea?

Ability to display arbitrary output (puts)

Currently we are displaying output from rspec only, which seems to not include any puts statements that might be in the code, which are often used for debugging. Figure out how to capture those and display them inline with the tests, if possible.

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.