This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
9 Replies Last post: Jun 9, 2009 6:22 PM by Roman.Chernyatchik  
karl baum Newbie 5 posts since
Jun 8, 2009
Currently Being Moderated

Jun 17, 2009 1:39 PM

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..

Roman.Chernyatchik  JetBrains 1,452 posts since
Sep 18, 2007
Currently Being Moderated
Jun 9, 2009 3:13 AM in response to: karl baum
Re: autospec in rubymine

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

 

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

Roman.Chernyatchik  JetBrains 1,452 posts since
Sep 18, 2007
Currently Being Moderated
Jun 9, 2009 2:31 PM in response to: karl baum
Re: autospec in rubymine

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.

Roman.Chernyatchik  JetBrains 1,452 posts since
Sep 18, 2007
Currently Being Moderated
Jun 9, 2009 4:08 PM in response to: karl baum
Re: autospec in rubymine

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


Roman.Chernyatchik  JetBrains 1,452 posts since
Sep 18, 2007
Currently Being Moderated
Jun 9, 2009 5:07 PM in response to: karl baum
Re: autospec in rubymine

1. In console please execute "which autotest"

2. And does autospec work from console?

3. Launch RubyMine from console and check does autospec work

Roman.Chernyatchik  JetBrains 1,452 posts since
Sep 18, 2007
Currently Being Moderated
Jun 9, 2009 6:25 PM in response to: karl baum
Re: autospec in rubymine

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

More Like This

  • Retrieving data ...