Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rtlechow/dotfiles
base: b927d58441
...
head fork: rtlechow/dotfiles
compare: fae93abaa7
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 53 additions and 0 deletions.
  1. +52 −0 .vimrc
  2. +1 −0  .zshrc
View
52 .vimrc
@@ -158,3 +158,55 @@ map <leader>gg :topleft 100 :split Gemfile<cr>
map <leader>f :CommandTFlush<cr>\|:CommandT<cr>
map <leader>F :CommandTFlush<cr>\|:CommandT %%<cr>
set wildignore+=.git,tmp/**,vendor/bundle/**
+
+function! RunTests(filename)
+ " Write the file and run tests for the given filename
+ :w
+ :silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
+ if match(a:filename, '\.feature$') != -1
+ exec ":!bundle exec cucumber " . a:filename
+ else
+ if filereadable("Isolate") && filereadable("script/test")
+ exec ":!rake isolate:sh\\['script/test " . a:filename . "'\\]"
+ elseif filereadable("script/test")
+ exec ":!script/test " . a:filename
+ elseif filereadable("Isolate")
+ exec ":!rake isolate:sh\\['rspec --color " . a:filename . "'\\]"
+ elseif filereadable("Gemfile")
+ exec ":!bundle exec rspec --color " . a:filename
+ else
+ exec ":!rspec --color " . a:filename
+ end
+ end
+endfunction
+
+function! SetTestFile()
+ " Set the spec file that tests will be run for.
+ let t:rtl_test_file=@%
+endfunction
+
+function! RunTestFile(...)
+ if a:0
+ let command_suffix = a:1
+ else
+ let command_suffix = ""
+ endif
+
+ " Run the tests for the previously-marked file.
+ let in_test_file = match(expand("%"), '\(.feature\|_spec.rb\)$') != -1
+ if in_test_file
+ call SetTestFile()
+ elseif !exists("t:rtl_test_file")
+ return
+ end
+ call RunTests(t:rtl_test_file . command_suffix)
+endfunction
+
+function! RunNearestTest()
+ let spec_line_number = line('.')
+ call RunTestFile(":" . spec_line_number)
+endfunction
+
+map <leader>t :call RunTestFile()<cr>
+map <leader>T :call RunNearestTest()<cr>
+map <leader>a :call RunTests('')<cr>
View
1  .zshrc
@@ -1,3 +1,4 @@
+stty -ixon
typeset -U path manpath gem_home gem_path
path=(~/.bin /usr/local/bin $path)
cdpath=(~/code ~/Dropbox ~/code/work $cdpath)

No commit comments for this range

Something went wrong with that request. Please try again.