Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #24 from rejeep/master

Several small improvements from rejeep
  • Loading branch information...
commit 061e9f351fad85e3e0069038b336f717bbf8b926 2 parents 2dc0fa0 + 42dadc8
Peter Williams authored

Showing 2 changed files with 38 additions and 3 deletions. Show diff stats Hide diff stats

  1. +33 0 README.md
  2. +5 3 rspec-mode.el
33 README.md
Source Rendered
... ... @@ -0,0 +1,33 @@
  1 +# Emacs Rspec Mode
  2 +Rspec mode provides some convenience functions related to dealing with RSpec.
  3 +
  4 +## Installation
  5 +I recommend installing via ELPA, but manual installation is simple as well:
  6 +
  7 + (add-to-list 'load-path "/path/to/rspec-mode")
  8 + (require 'rspec-mode)
  9 +
  10 +## Usage
  11 +If `rspec-mode` is installed properly, it will be started
  12 +automatically when `ruby-mode` is started.
  13 +
  14 +See `rspec-mode.el` for further usage.
  15 +
  16 +## Gotchas
  17 +
  18 +### Zsh and RVM
  19 +If you use `ZSH` and `RVM`, you may encounter problems running the
  20 +specs. It may be so that an older version of Ruby, than the one you
  21 +specified in `.rvmrc`, is used. This is because `ZSH` runs a small
  22 +script each time a shell is created, which modifies the `$PATH`. The
  23 +problem is that it prepends some default paths, such as `/usr/bin`,
  24 +which contains another `ruby` binary.
  25 +
  26 +What you can do to solve this is to use `BASH` for running the
  27 +specs. This piece of code does the job:
  28 +
  29 + (defadvice rspec-compile (around rspec-compile-around)
  30 + "Use BASH shell for running the specs because of ZSH issues."
  31 + (let ((shell-file-name "/bin/bash"))
  32 + ad-do-it))
  33 + (ad-activate 'rspec-compile)
8 rspec-mode.el
@@ -121,7 +121,7 @@
121 121 :type 'string
122 122 :group 'rspec-mode)
123 123
124   -(defcustom rspec-spec-command "spec"
  124 +(defcustom rspec-spec-command "rspec"
125 125 "The command for spec"
126 126 :type 'string
127 127 :group 'rspec-mode)
@@ -438,8 +438,10 @@
438 438 (defun rspec-project-root (&optional directory)
439 439 "Finds the root directory of the project by walking the directory tree until it finds a rake file."
440 440 (let ((directory (file-name-as-directory (or directory default-directory))))
441   - (cond ((rspec-root-directory-p directory) nil)
442   - ((file-exists-p (concat directory "Rakefile")) directory)
  441 + (cond ((rspec-root-directory-p directory)
  442 + (error "Could not determine the project root."))
  443 + ((file-exists-p (expand-file-name "Rakefile" directory)) directory)
  444 + ((file-exists-p (expand-file-name "Gemfile" directory)) directory)
443 445 (t (rspec-project-root (file-name-directory (directory-file-name directory)))))))
444 446
445 447 (defmacro rspec-from-direcory (directory body-form)

0 comments on commit 061e9f3

Please sign in to comment.
Something went wrong with that request. Please try again.