Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added RunLastRubyTest class to run_ruby_test.py. Added menu items and…

… context items to run last test
  • Loading branch information...
commit 1c4abd4b4381469ca7e7cbd6c0fe59f4aada997a 1 parent aeeb4ac
@joneath joneath authored
View
1  Context.sublime-menu
@@ -6,6 +6,7 @@
[
{ "caption": "Run single test / scenario / spec", "command": "run_single_ruby_test" },
{ "caption": "Run all tests / feature / full spec", "command": "run_all_ruby_test" },
+ { "caption": "Run last test(s) / feature / spec", "command": "run_last_ruby_test" },
{ "caption": "-" },
{ "caption": "Show test panel", "command": "show_test_panel" },
{ "caption": "-" },
View
1  Default (Linux).sublime-keymap
@@ -1,6 +1,7 @@
[
{ "keys": ["ctrl+shift+r"], "command": "run_single_ruby_test" }, // single test
{ "keys": ["ctrl+shift+t"], "command": "run_all_ruby_test" }, // test file
+ { "keys": ["ctrl+shift+e"], "command": "run_last_ruby_test" }, // test file
{ "keys": ["ctrl+shift+x"], "command": "show_test_panel" }, // show test panel
View
1  Default (OSX).sublime-keymap
@@ -1,6 +1,7 @@
[
{ "keys": ["super+shift+r"], "command": "run_single_ruby_test" }, // single test
{ "keys": ["super+shift+t"], "command": "run_all_ruby_test" }, // test file
+ { "keys": ["super+shift+e"], "command": "run_last_ruby_test" }, // test file
{ "keys": ["super+shift+x"], "command": "show_test_panel" }, // show test panel
View
1  Default (Windows).sublime-keymap
@@ -1,6 +1,7 @@
[
{ "keys": ["ctrl+shift+r"], "command": "run_single_ruby_test" }, // single test
{ "keys": ["ctrl+shift+t"], "command": "run_all_ruby_test" }, // test file
+ { "keys": ["ctrl+shift+e"], "command": "run_last_ruby_test" }, // test file
{ "keys": ["ctrl+shift+x"], "command": "show_test_panel" }, // show test panel
View
1  Main.sublime-menu
@@ -9,6 +9,7 @@
[
{ "caption": "Run single test / scenario / spec", "command": "run_single_ruby_test" },
{ "caption": "Run all tests / feature / full spec", "command": "run_all_ruby_test" },
+ { "caption": "Run last tests / feature / spec", "command": "run_last_ruby_test" },
{ "caption": "-" },
{ "caption": "Show test panel", "command": "show_test_panel" },
{ "caption": "-" },
View
1  README.md
@@ -36,6 +36,7 @@ Usage
- Run single ruby test: Command-Shift-R
- Run all ruby tests from current file: Command-Shift-T
+ - Run last ruby test(s): Command-Shift-E
- Show test panel: Command-Shift-X
- Check RB, ERB file syntax: Alt+Shift+V
View
4 RubyTest.last-run
@@ -0,0 +1,4 @@
+{
+ "last_test_run": "",
+ "last_test_file": ""
+}
View
24 run_ruby_test.py
@@ -67,6 +67,13 @@ def load_config(self):
global CUCUMBER_UNIT_FOLDER; CUCUMBER_UNIT_FOLDER = s.get("ruby_cucumber_folder")
global RSPEC_UNIT_FOLDER; RSPEC_UNIT_FOLDER = s.get("ruby_rspec_folder")
+ def save_test_run(self, ex, file_name):
+ s = sublime.load_settings("RubyTest.last-run")
+ s.set("last_test_run", ex)
+ s.set("last_test_file", file_name)
+
+ sublime.save_settings("RubyTest.last-run")
+
def show_tests_panel(self):
if not hasattr(self, 'output_view'):
self.output_view = self.window.get_output_panel("tests")
@@ -152,6 +159,8 @@ def run(self):
ex = self.project_path(folder_name , RSPEC_UNIT + " " + rspec_folder + file_name + " -e " + test_name)
if match_obj:
+ self.save_test_run(ex, file_name)
+
self.show_tests_panel()
self.is_running = True
@@ -181,10 +190,25 @@ def run(self):
sublime.error_message("Only *_test.rb, *_spec.rb, *.feature files supported!")
return
+ self.save_test_run(ex, file_name)
+
self.is_running = True
self.proc = AsyncProcess(ex, self)
StatusProcess("Starting tests from file " + file_name, self)
+class RunLastRubyTest(RunSingleRubyTest):
+ def load_last_run(self):
+ s = sublime.load_settings("RubyTest.last-run")
+ global LAST_TEST_RUN; LAST_TEST_RUN = s.get("last_test_run")
+ global LAST_TEST_FILE; LAST_TEST_FILE = s.get("last_test_file")
+
+ def run(self):
+ self.load_last_run()
+ self.show_tests_panel()
+ self.is_running = True
+ self.proc = AsyncProcess(LAST_TEST_RUN, self)
+ StatusProcess("Starting tests from file " + LAST_TEST_FILE, self)
+
class ShowTestPanel(sublime_plugin.WindowCommand):
def run(self):
self.window.run_command("show_panel", {"panel": "output.tests"})
Please sign in to comment.
Something went wrong with that request. Please try again.