Can't run RSpec test
I attached the gem as described in the video but am getting a basic error when running the project:
Fail to load: /Users/antonystubbs/RubymineProjects/untitled/receipt_processor_spec.rb:1
Exception message: undefined method `describe' for main:Object
/Users/antonystubbs/RubymineProjects/untitled/receipt_processor_spec.rb:5
/Applications/RubyMine 2.0 Beta 2.app/rb/testing/runner/tunit_in_folder_runner.rb:41:in `require'
/Applications/RubyMine 2.0 Beta 2.app/rb/testing/runner/tunit_in_folder_runner.rb:41
/Applications/RubyMine 2.0 Beta 2.app/rb/testing/runner/tunit_in_folder_runner.rb:35:in `each'
/Applications/RubyMine 2.0 Beta 2.app/rb/testing/runner/tunit_in_folder_runner.rb:35
-e:1:in `load'
-e:1
i.e.
require 'receipt_processor'
describe ReceiptProcessor do
it "should calculate gst for input 1" do
input1 = <<ML
And when I try to run spec as a rake task, typing 's' after going run task, brings up on results - "no matches found". In fact, there are no matches for any letter I try - that's probably a clue.
Any clues?
P.s. it runs fine using 'spec' form the command line.
Please sign in to leave a comment.
Hi,
Add following lines to the top of the file.
In you case RubyMine doesn't understand that your file is rspec test and tries to launch it using ruby interpreter as general ruby script (instead of spec runner script). Attaching gems in RubyMine affects RubyMine's code insight features (resolve, autocompletion, etc) but RM also always analyzes files which are required in current file.
Thanks. But now I get this error: undefined method bin_path for Gem:Module. It's the same problem I get in NetBeans. But again, it runs fine from the command line. Environment problem? I originally installed Ruby etc using macports.
Please execute "which ruby" command in console
As you can mention RubyMine and your console uses different Ruby interpreters
Output from RubyMine:
and you console:
It is due to Mac OS general problem related to environment variables, please read javascript:;
Or instead of correct environment setup you can just ask RubyMine to use /opt/local/bin/ruby as your ruby interpreter - see RubyMine | File | Settings | RubySDK and Gems, "Add SDK" button
Ok, that's made some progress. Switching RubyMine to use /opt/local/bin/ruby seems run the the tests, Rubymine very quickly reports "all tests passed", but then goes into an unresponsive state, and I have to force quit :/
However I don't think it's actually running the tests - or perhaps not running all the tests, because if i modify a test so that it will fail before running this, it still reports all tests pass.
Hmm, after 4 restarts, not it seems to work as expected, without me having changed anything to prevent the crashing.
And this is RubyMine bug, please track issue http://youtrack.jetbrains.net/issue/RUBY-5201. As far as I know it appeared in RubyMine 2.0 Beta 2 and first our beta doesn't contain it.. Bug will be fixed in next public build.
Cool- thanks for the support.
Will have to check RubyMine out again for my next job interview
Antony, we've just published RubyMine 2.0 Beta 3. Please try it, I hope the issue is fixed there
Cool - a quick test looks good.