From 2c01d4daeff989a556083d26b7c6e5cf7f89b472 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 5 Feb 2022 17:41:36 -0500 Subject: Prefix old post file names with dates. --- posts/2013-12-17-rinari-jasmine.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 posts/2013-12-17-rinari-jasmine.md (limited to 'posts/2013-12-17-rinari-jasmine.md') diff --git a/posts/2013-12-17-rinari-jasmine.md b/posts/2013-12-17-rinari-jasmine.md new file mode 100644 index 0000000..cb94b1f --- /dev/null +++ b/posts/2013-12-17-rinari-jasmine.md @@ -0,0 +1,36 @@ +title: Jump to Jasmine Specs with Rinari +date: 2013-12-17 13:00 +tags: emacs, javascript, wsu +summary: I hacked rinari mode to jump between JS sources and jasmine tests +--- + +I use the [rinari](https://github.com/eschulte/rinari) Emacs mode to +assist me when working on rails projects. One of rinari’s most useful +features is the ability to quickly jump from one file to another +related file. I use this feature almost exclusively for jumping +between a ruby class file and its associated rspec file, but lately +I’ve been spending most of my time writing javascript. At VHL, we use +[jasmine](http://pivotal.github.io/jasmine/) for our unit testing +framework and the +[jasmine ruby gem](https://github.com/pivotal/jasmine-gem) to +integrate it with our rails projects. Rinari doesn’t have any +built-in jump settings for jasmine test files, so I wrote this quick +hack to make it work: + +```elisp +;; Make rinari jump to/from javascript source files and specs. +(setcdr (assoc 'javascript rinari-jump-schema) + '("j" + (("app/assets/javascripts/\\1.js" . "spec/javascripts/\\1_spec.js") + ("spec/javascripts/\\1_spec.js" . "app/assets/javascripts/\\1.js") + (t . "spec/javascripts/.*") + (t . "app/javascripts/.*")) + t)) +(rinari-apply-jump-schema rinari-jump-schema) +``` + +Now I can press `C-c ; f j` to jump between a javascript file in +`app/assets/javascripts/` and its jasmine test file in +`spec/javascripts/`. Perhaps I shouldn’t be overwriting the +predefined (but not very useful) javascript jump settings, but I +really wanted to use the `j` key. -- cgit v1.2.3