Running Rspec tests in TextMate
For a while I had a problem running my Rspec tests using the TextMate bundle. It was calling the wrong lib for Ruby, even though I had the shell variables set correctly in the TextMate preferences. When I tried to run a spec in TextMate, I got this:
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:377:in
`report_activate_error’: Could not find RubyGem rails (>= 0)
(Gem::LoadError) from
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:309:in `activate’ from
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:76:in
`active_gem_with_options’ from
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:50:in `gem’ from
/Users/lisasawin/Rails Web Applications/CHC/config/boot.rb:39 from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require’ from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
from /Users/lisasawin/Rails Web Applications
/CHC/config/environment.rb:11 from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require’ … 15 levels… from
/Users/lisasawin/Library/Application
Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/../spec/mate/runner.rb:31:in
`chdir’ from
/Users/lisasawin/Library/Application
Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/../spec/mate/runner.rb:31:in
`run’ from
/Users/lisasawin/Library/Application
Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/../spec/mate/runner.rb:14:in
`run_file’ from /tmp/temp_textmate.zQ2Hv1:4
I just couldn’t get TextMate to use the library in usr/local/bin/ruby instead of looking in usr/lib/ruby, I gave up for a while and ran tests manually in a shell, but that was a pain. Another web search led me to dnite’s blog. He described how to set up a new ~/.MacOSX/environment.plist with the correct PATH definition:
<?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN”
<plist version=”1.0″>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin</string>
</dict>
</plist>
Don’t forget to log out & in for it to take effect. Worked for me!
Discussion Area - Leave a Comment
You must be logged in to post a comment.