autospec in rubymine

Is there a way to run autospec in rubymine?  What i would really like is the ability to click on the line in the autospec stack trace and be taken to the line of code with the issue.

thx..

9 comments
Comment actions Permalink

Yes, it's possible, but without GUI test runner.

Open "RubyMine | Tools | Run Rails Script.." dialog and select autospec script.

0
Comment actions Permalink

Tried this and it almost worked but for some reason rubymine is using the wrong ruby version in this case.  I have gone to preferences and ensured it is configured with the correct /usr/local/bin/ruby but for some reason, rubymine is using /usr/bin/ruby when i run the autospec script.  Is this a path issue?  When working from the term, I set my PATH to point to /usr/local/bin in my .bash_profile but without that my mac would point to /usr/bin.

thx.

-karl

0
Comment actions Permalink

Karl,

Tried this and it almost worked but for some reason rubymine is using the wrong ruby version in this case.  I have gone to preferences and ensured it is configured with the correct /usr/local/bin/ruby but for some reason, rubymine is using /usr/bin/ruby when i run the autospec script.

Karl, please take a look at command line which RubyMine uses for executing autospec script. Does RubyMine use the same interpreter is selected in RubyMine | Settings | RubySDK and Gems

I set my PATH to point to /usr/local/bin in my .bash_profile but without that my mac would point to /usr/bin.

MacOS applies .bash_profile only for Terminal.app environment and Apple suggests to use ~/.MacOSX/environment.plist. But if ruby script doesn't invoke 'ruby' system command or invokes another ruby interpreter using current ruby interpreter path (e.g. rake gem does this) environment.plist isn't necessary for RubyMine.

0
Comment actions Permalink
Does RubyMine use the same interpreter is selected in RubyMine | Settings | RubySDK and Gems


It's a bit confusing but the path to the ruby executable is correct (/usr/local/bin/ruby), but the error message at the bottom is indicating that it is using the old ruby 1.8.6 while /usr/local/bin/ruby is actually version 1.8.7.  Hence my missing gems.

/usr/local/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /Users/karl/NetBeansProjects/weshopnetwork/script/autospec
(Not running features.  To run features in autotest, set AUTOFEATURE=true.)
loading autotest/rails_rspec
Missing these required gems:
....

You're running:
  ruby 1.8.6.287 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  rubygems 1.3.1 at /Users/karl/.gem/ruby/1.8, /Library/Ruby/Gems/1.8, /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8


I hope this makes sense :-).  Thanks for your help!

-karl

0
Comment actions Permalink

Let's take a look at './script/autospec'



#!/usr/bin/env ruby
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
ENV['RSPEC'] = 'true'     # allows autotest to discover rspec
ENV['AUTOTEST'] = 'true'  # allows autotest to run w/ color on linux
system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
  $stderr.puts("Unable to find autotest.  Please install ZenTest or fix your PATH")





Obviously this code will run "autotest" system command.

On my mac:

/usr/bin/autototest:

!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -ws
#
# This file was generated by RubyGems.
#
# The application 'ZenTest' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'ZenTest', version
load Gem.bin_path('ZenTest', 'autotest', version)


Thus script will be executed with bundled ruby 1.8.6.

As I mentioned before fix PATH env variable for RubyMine using ~/.MacOSX/environment.plist



0
Comment actions Permalink

I added the following to my environment.plist and when I execute a term I can see it works.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>PATH</key>
        <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin</string>
</dict>
</plist>

But... i still get the same errors when i run autospec.

/usr/local/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /Users/karl/NetBeansProjects/weshopnetwork/script/autospec
(Not running features.  To run features in autotest, set AUTOFEATURE=true.)
loading autotest/rails_rspec
Missing these required gems:
....

You're running:
  ruby 1.8.6.287 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  rubygems 1.3.1 at /Users/karl/.gem/ruby/1.8, /Library/Ruby/Gems/1.8, /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

thx

-karl

0
Comment actions Permalink

1. In console please execute "which autotest"
2. And does autospec work from console?
3. Launch RubyMine from console and check does autospec work

0
Comment actions Permalink
1. In console please execute "which autotest"

/usr/local/bin/autospec

2. And does autospec work from console?


Yes

3. Launch RubyMine from console and check does autospec work


It worked.  I guess i am missing another setting?  Is there a way to execute my .bash_profile before launching rubymine without running it from the terminal?

Thanks again!

-karl

0
Comment actions Permalink

I suppose MacOS doesn't apply environment.plist options to RubyMine. You should logout and login again after changing environment.plist. I've checked this on my mac, all works ok.

Just run IRB from RubyMine and type: p ENV['PATH'] to check environment from RubyMine

0

Please sign in to leave a comment.