Reputation: 13869
I am trying to running a sample test suite from Sublime Text 3.
This is my example that I created using bundle gem foo -t minitest
class TestFoo < MiniTest::Unit::TestCase
def test_that_it_has_a_version_number_test
refute_nil ::Foo::VERSION
end
def test_it_does_something_useful_test
assert true
end
end
I have installed the RubyTest package, and the binding to run the test suite is Ctrl + Shift + T
I get the following error:
/home/thetuxracer/.rvm/rubies/ruby-2.0.0-p247/bin/ruby:1: Invalid char `\x7F' in expression
/home/thetuxracer/.rvm/rubies/ruby-2.0.0-p247/bin/ruby:1: Invalid char `\x02' in expression
/home/thetuxracer/.rvm/rubies/ruby-2.0.0-p247/bin/ruby:1: Invalid char `\x01' in expression
/home/thetuxracer/.rvm/rubies/ruby-2.0.0-p247/bin/ruby:1: Invalid char `\x01' in expression
/home/thetuxracer/.rvm/rubies/ruby-2.0.0-p247/bin/ruby:1:in `<main>': uninitialized constant ELF (NameError)
[Finished in 0.3s with exit code 1]
Observations:
I have installed ruby 2.0.0p247 using rvm. If I run the tests from the CLI, using
ruby -Itest foo_test.rb
the tests run fine.
I also ensured that the key check_for_rvm
in RubyTest.sublime-settings is set to true
What seems to be the problem here? Please let me know if there is anymore information that you may need to help me out.
EDIT: I tried this on a Mac Os X 10.8.4 with ST3 and ruby 2.0.0p247. In the Rakefile, I have also added this line t.test_files = FileList['test/test_*.rb']
in the RakeTask.
I looked at this bug and started ST from the shortcut. But the tests still didnt run.
Upvotes: 2
Views: 2874
Reputation: 13869
I tried everything, from changing configurations in existing projects where the minitest runs, to re-installing the ST3 package to reinstalling ruby itself as a last resort. The problem, it turns out was way smaller.
When I execute this command bundle foo -t minitest
the following files are created:
bundle gem foo -t minitest
create foo/Gemfile
create foo/Rakefile
create foo/LICENSE.txt
create foo/README.md
create foo/.gitignore
create foo/foo.gemspec
create foo/lib/foo.rb
create foo/lib/foo/version.rb
create foo/test/minitest_helper.rb
create **foo/test/test_foo.rb**
create foo/.travis.yml
Notice the name of the file containing test cases. I renamed it to foo_test
and it just worked.
I now need to figure out, why minitest needs the filename in that particular format and if possible, change/edit it.
Upvotes: 0
Reputation: 1165
From looking at this issue, it's probably related to your bundler generated binstubs.
Looking at the RVM docs, you might want to try running:
gem regenerate_binstubs
or:
bundle install --binstubs
If you still have issues after that, I'd try totally removing the binstubs. Instructions for doing that can be found here.
Upvotes: 1