maltize/sublime-text-2-ruby-tests

rvm and ruby 2.0 error

error400 opened this issue · 14 comments

If i want to execute a test i get the following error:

~/.rvm/rubies/ruby-2.0.0-p0/bin/ruby:1: invalid multibyte char (UTF-8)
[Finished in 0.2s with exit code 1]

any Suggestions?

This is not limited to Ruby 2.0, I'm receiving something very similar:

/Users/sheldon/.rvm/rubies/ruby-1.9.3-p429/bin/ruby:1: invalid multibyte char (US-ASCII)
[Finished in 0.3s with exit code 1]

This is with "check_for_rvm": true, if I set "check_for_rvm": false then I don't get this error but then the system Ruby is used, which doesn't work for me.

I've tried putting # encoding: utf-8 at the top of the file but this does not fix it.

I've also tried starting ST2 from the command line with subl . and this does not fix the issue either.

Just checking in, I'd love to use this plugin, anyone got any ideas?

gs commented

Hey,

I have a project ruby 2 + rails 4 and have no problems with running plugin - but I'm using chruby.

When you run the tests from command line then all works?

Yes the tests run totally normally from the command line :)

I also ran into the same issue
/Users/Jack/.rvm/rubies/ruby-1.9.3-p448/bin/ruby:1: invalid multibyte char (US-ASCII)
Have you solved the problem yet? Thanks

No I haven't, I will just stick to the console :)

gja commented

Could someone paste a stack trace please? You can get it from opening the ctrl-` console.

Exactly same problem here.

/Users/gaston/.rvm/rubies/ruby-1.9.3-p429/bin/ruby:1: invalid multibyte char (US-ASCII)
[Finished in 0.3s with exit code 1]

Running /Users/gaston/.rvm/bin/rvm-auto-ruby -S ruby -Itest test/unit/payment_test.rb
reloading /Users/gaston/Library/Application Support/Sublime Text 2/Packages/User/RubyTest.last-run
Writing file /Users/gaston/Sites/XXXX/test/unit/payment_test.rb with encoding UTF-8

It works for me after I changed the lines in RubyTest.sublime-settings:

"run_ruby_unit_command": "ruby -Itest {relative_path}",
"run_single_ruby_unit_command": "ruby -Itest {relative_path} -n '{test_name}'",

to

"run_ruby_unit_command": "-Itest {relative_path}",
"run_single_ruby_unit_command": "-Itest {relative_path} -n '{test_name}'",

After the change (using example from the above post)
/Users/gaston/.rvm/bin/rvm-auto-ruby -S ruby -Itest test/unit/payment_test.rb
now should run
/Users/gaston/.rvm/bin/rvm-auto-ruby -S -Itest test/unit/payment_test.rb

@jackchang awesome, worked for me!

thanks! the above worked for me too..

I started seeing this problem after I upgraded to Yosemite (OSX 10.10).

At first, I was getting a problem about a mis-match in ruby version in Bunder's validate_ruby! method. Then changed the setting "check_for_rvm" to true. At that point, my ruby version mis-match disappeared, but this started to happen. I used @jackchang 's approach and it started working.

@jackchang thanks. but I have a problem if I use bundle it says:
bundler: command not found: -Itest
Install missing gem executables with bundle install

Any solutions?