Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Do not assume 'rspec' found on $PATH is suitable #214

wants to merge 1 commit into from

3 participants


It could be arbitrarily old, or the Ruby run time that is running thor :spec may have a more suitable rspec.


Doesn't this depend on rubygems?


I suppose so.

Otherwise, we'd need something like:

require 'rbconfig'
ruby = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["RUBY_INSTALL_NAME"])
exec "#{ruby} -S rspec --color --format=documentation spec"

Wait, why is this a problem? Don't you guys run the specs with bundle exec thor spec?


I suspect that the problem becomes "Do not assume bundle found on $PATH is suitable," then.


I'm still having trouble understanding why this is a problem. This is for running thor's own specs on a machine you control, right? Or is this trying to fix something else?


I have a JRuby installation that has its own rspec. In $PATH, rspec points to MRI's. exec will pick the latter. Problems ensue.


I see. Do you not use bundler to run the specs? Seems to me that would fix the problem (and is what you ought to be using anyway).

@sferik sferik closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  Thorfile
2  Thorfile
@@ -25,6 +25,6 @@ class Default < Thor
desc "spec", "Run RSpec code examples"
def spec
- exec "rspec --color --format=documentation spec"
+ exec "#{Gem.ruby} -S rspec --color --format=documentation spec"
Something went wrong with that request. Please try again.