Skip to content

jpablobr/testr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TestR

Quick and easy Ruby (Rspec and Test::Unit) TDD on Emacs.

Mostly based off Jim Weirich emacs-setup-esk/testing.el.

It also includes toggle.el:

;; toggle.el --- quickly open corresponding file (eg test vs impl).
;; Copyright (C) 2006-2007 by Ryan Davis
;; Author: Ryan Davis <[email protected]>

PS. It has nothing to do with the TestR (renamed to Tork) project. I just stole the name :)

anyway,

Features:

Quickly

  • jump between {specs,tests} for fast viewing and editing.
  • run {specs,tests} files.
  • run {specs,tests} methods.

Installation:

In your emacs config:

(add-to-list 'load-path "~/.emacs.d/load/path/testr.el")
(require 'testr)

noansi

By default it will remove non-ansi characters with the bin/noansi ruby script. So, you should put it somewhere in your $PATH.

$ cd testr
$ cp bin/noansi ~/bin # if ~/bin is in your $PATH

.env.rc

If you would like to define $ENV specific setting for your project you could add them to an .env.rc file in your project's root directory.

.togglerc

If you want to use the toggling functionality, you should add a .togglerc file to your project's root directory.

Example -- Set the style only:

(buffer-toggle-style 'my-project-name)

Example -- Define a mapping and then select it:

(buffer-toggle-mapping
'(my-project-name    
  (("test/\\1_test.rb" . "lib/\\1.rb")
  ("\\1_test.rb"      . "\\1.rb"))))
(buffer-toggle-style 'my-project-name)

For more examples see jimweirich .togglerc here or mine.

Finally:

M-x testr-mode

or for true TDD:

(add-hook 'ruby-mode-hook '(lambda () (testr-mode)))

Usage

Key binding:

  • M-t => testr-toggle-buffer
  • C-c tf => testr-run-test-file
  • C-c tm => testr-run-test-method
  • C-c sf => testr-run-spec-file
  • C-c sm => testr-run-spec-method
  • C-c rr => testr-run-last-test-or-spec-file
  • C-c rm => testr-run-last-test-or-spec-method

Complete list of functions:

testr-mode
testr-code-test-split
testr-kill-test-buffer
testr-mark-for-testing
testr-run-last-test-or-spec-file
testr-run-last-test-or-spec-method
testr-run-spec-file
testr-run-spec-method
testr-run-test-file
testr-run-test-functionals
testr-run-test-integration
testr-run-test-method
testr-run-test-or-spec-file
testr-run-test-or-spec-method
testr-run-test-rake
testr-run-test-units
testr-split-or-toggle
testr-toggle-buffer
testr-toggle-clear-buffer-styles
testr-toggle-warnings

About

Emacs quick and easy Ruby TDD

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published