From dfdb91aa2dd792aa9074f4f15adb2ab32afb80d1 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 5 Dec 2017 23:30:42 +0100 Subject: ftplugin/ruby.vim: Add mapping to reset the Rails test database Occasionally I need to drop and reload the Rails test database. Recently I've been working on something that requires a "truncation"-cleaned test, and have had to reset my database regularly while writing the test to eliminate inconsistent state. This command gives me the ability to reset with a single key press. I've been testing it out for a few days in a Vim session and have found it very helpful. --- ftplugin/ruby.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ftplugin/ruby.vim') diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 2abb417..c829abe 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -18,6 +18,10 @@ nnoremap Zd obyebug nnoremap ZD Obyebug +" Reset Rails test database +nnoremap :!RAILS_ENV=test bundle exec rake db:reset + + " Spring command! -buffer FuckSpring :!bundle exec spring stop -- cgit v1.2.3