From 802802fdd7388388d8ad13bc2c2b8d5b2e48cbad Mon Sep 17 00:00:00 2001 From: Dmitry Galinsky Date: Wed, 4 Mar 2009 23:33:00 +0300 Subject: [PATCH] Fixed broken test runner. --- bundles/rails-rspec-bundle.el | 2 +- rails-compile.el | 14 ++++++++++---- rails-reloaded.el | 6 +++--- rails-resources.el | 13 ++++++++----- rails-runner.el | 5 ++++- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/bundles/rails-rspec-bundle.el b/bundles/rails-rspec-bundle.el index e5249ae..1a8e3b5 100644 --- a/bundles/rails-rspec-bundle.el +++ b/bundles/rails-rspec-bundle.el @@ -2,7 +2,7 @@ ;;; - Variables ;;; -(defvar rails/rspec-bundle/command "spec") +(defvar rails/rspec-bundle/command (format "%s script/spec" rails/ruby/command)) (defvar rails/rspec-bundle/spec-options "-O spec/spec.opts") ;;; --------------------------------------------------------- diff --git a/rails-compile.el b/rails-compile.el index 006b27b..8ed27b5 100644 --- a/rails-compile.el +++ b/rails-compile.el @@ -87,18 +87,24 @@ (defun rails/compile/run-file (root rails-buffer command args-pattern &optional file-pattern) (let ((item (when rails-buffer - (rails/resources/get-associated-test-item-for-buffer root - rails-buffer))) + (rails/resources/get-associated-test-item-for-buffer + root + rails-buffer))) + (match (when file-pattern + (string-ext/string=~ file-pattern + (rails/resource-buffer-file rails-buffer) + t))) file) (cond - (item + ((and item + (if file-pattern match t)) (setq file (rails/resource-item-file item)) (rails/compile/run root command (format args-pattern file))) ((and file-pattern - (string-ext/string=~ file-pattern (buffer-file-name) t)) + match) (rails/compile/run root command (format args-pattern diff --git a/rails-reloaded.el b/rails-reloaded.el index 96a7d49..263ff40 100644 --- a/rails-reloaded.el +++ b/rails-reloaded.el @@ -213,9 +213,9 @@ (define-keys map ([menu-bar] (rails-minor-mode-menu-bar-map)) ((rails/short-key "") 'rails/resources/toggle) - ((rails/short-key "") 'rails/resources/toggle-test) - ((rails/short-key ";") 'rails/goto-associated) - ((rails/short-key "'") 'rails/goto) + ((rails/short-key "t") 'rails/resources/toggle-test) + ((rails/short-key "'") 'rails/goto-associated) + ((rails/short-key ";") 'rails/goto) ((rails/short-key "/") 'rails/runner/toggle-output-window) ((kbd "\e\e e") 'rails/set-default-environment) ((rails/key ".") 'rails/compile/single-file) diff --git a/rails-resources.el b/rails-resources.el index 2917a3b..7dd2e33 100644 --- a/rails-resources.el +++ b/rails-resources.el @@ -442,12 +442,15 @@ (let ((test-res (rails/resources/test-buffer-p root rails-buffer))) (if test-res ;; it's the test, run it - (rails/resources/get-associated-items-by-resource root - rails-buffer - test-res) + (car + (rails/resources/get-associated-items-by-resource + root + rails-buffer + test-res)) ;; it's have the link to test - (rails/resources/linked-to-test-item-of-buffer root - rails-buffer)))) + (rails/resources/linked-to-test-item-of-buffer + root + rails-buffer)))) (defun rails/resources/toggle-test () (interactive) diff --git a/rails-runner.el b/rails-runner.el index cfad60e..17bbca7 100644 --- a/rails-runner.el +++ b/rails-runner.el @@ -122,7 +122,8 @@ BUFFER-MAJOR-MODE." (with-current-buffer (get-buffer rails/runner/buffer-name) (let ((buffer-read-only nil)) (delete-region (point-min) (point-max))))) - (in-directory root + (in-directory (if (string-ext/end-p root "/") + root (concat root "/")) (let ((proc (rails/proxy/shell-command root rails/runner/buffer-name rails/runner/buffer-name @@ -130,6 +131,8 @@ BUFFER-MAJOR-MODE." parameters))) (rails/runner/prepare-buffer proc) (with-current-buffer (process-buffer proc) + (setq default-directory (if (string-ext/end-p root "/") + root (concat root "/"))) (if (opt-val :mode options) (funcall (opt-val :mode options)) (rails/runner/output-mode))