Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
Added support rspec to the views.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmexe committed Mar 4, 2009
1 parent 4d903b5 commit 45f33a4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bundles/rails-basic-bundle.el
Expand Up @@ -22,7 +22,7 @@

(rails/defresource 'view "View"
:dir "app/views"
:group 'view
:group 'viewa
:file-pattern "{name}/.*"
:get-action-func '(lambda() (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))
:options 'expand-in-menu
Expand Down
11 changes: 10 additions & 1 deletion bundles/rails-rspec-bundle.el
Expand Up @@ -89,4 +89,13 @@
:dir "spec/factories"
:file-ext "rb"
:options 'pluralize
:link-to 'model-spec))
:link-to 'model-spec)

(rails/defresource 'view-spec "RSpec View"
:group 'views
:dir "spec/views"
:file-suffix "_spec"
:file-pattern "{name}/.*"
:file-ext "rb"
:options 'expand-in-menu
:test-to 'view ))
3 changes: 1 addition & 2 deletions rails-compile.el
Expand Up @@ -96,8 +96,7 @@
t)))
file)
(cond
((and item
(if file-pattern match t))
(item
(setq file (rails/resource-item-file item))
(rails/compile/run root
command
Expand Down
21 changes: 17 additions & 4 deletions rails-resources.el
Expand Up @@ -420,10 +420,23 @@
when test
return test)))
(when test-res
(car
(rails/resources/get-associated-items-by-resource root
rails-buffer
test-res)))))
(let ((items (rails/resources/get-associated-items-by-resource
root
rails-buffer
test-res))
(bfile (regexp-quote (file-name-nondirectory
(rails/resource-buffer-file rails-buffer)))))
(or
;; try find in multiple items by regexp (eq using to find view spec)
(loop for it in items
for match = (string-ext/string=~
bfile
(rails/resource-item-file it)
it)
when match
return it)
;; return first
(car items))))))

(defun rails/resources/test-buffer-p (root rails-buffer)
"Return resource contains :test-to link, otherwise return nil."
Expand Down

0 comments on commit 45f33a4

Please sign in to comment.