README.markdown in soundcheck-0.2.4.beta1 vs README.markdown in soundcheck-0.3.0
- old
+ new
@@ -8,9 +8,70 @@
One benefit of this is that you can set your editor to simply run `soundcheck
$filename`, and soundcheck will figure out how to run that test.
Soundcheck will also try to run your tests as fast as possible.
+## Usage
+
+```
+soundcheck
+=> runs all tests it can find
+
+soundcheck spec
+=> runs rspec tests
+
+soundcheck --fast spec
+=> runs only rspec tests that don't require spec_helper
+
+soundcheck spec/models/user_spec.rb
+=> runs that specific test
+```
+
+## How I use it with Vim
+
+```vim
+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
+ " For terminal Vim:
+ exec ":!soundcheck " . a:filename
+
+ " For graphical Vim:
+ "call Send_to_Tmux("soundcheck " . a:filename . "\n")
+endfunction
+
+function! SetTestFile()
+ " Set the spec file that tests will be run for.
+ let t:grb_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:grb_test_file")
+ return
+ end
+ call RunTests(t:grb_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>a :call RunTests('')<cr>
+```
+
## Is Soundcheck not working for your project?
Feel free to submit a pull request that adds only a fixture and RSpec testcase
which describes the situation in which it fails. If you can fix it yourself,
then great, but I'll happily accept patches that add more project styles which