Skip to content

TestUnit runner is used when having RSpec file with 'test' in name #228

Open
thomaslundstrom opened this Issue Mar 5, 2014 · 2 comments

2 participants

@thomaslundstrom

We are using RubyTest to run a few specs from within Sublime. However, some of our specs have been impossible to run - when we tried to run one test, we got the "No Test Found" alert, and when we tried to run the entire file, we got
/Users/{me}/.rvm/rubies/ruby-1.9.3-p484/bin/ruby:1: invalid multibyte char (US-ASCII)
[Finished in 0.7s with exit code 1]

This appeared quite recently - for me it appeared yesterday (I think) and for my team mate, it appeared one or two weeks ago. So yesterday I scratched my head a lot, but this morning I opened the console to view the error message, and I saw:
Running /Users/{me}/.rvm/bin/rvm-auto-ruby -S ruby -Itest spec/models/test_me_spec.rb

It seems RubyTest is trying to run the spec file with the TestUnit runner! I've spelunked a bit, and it seems as if as long as I have the word 'test' (as in test_me_spec.rb), I get the error. If I rename the file to 'spec_me_spec.rb' (or any other name that doesn't contain 'test') it works flawlessly.

(As to why I'm using the word 'test' in a spec - well, tests are a part of our domain, so our models names contain 'test'.)

@thomaslundstrom

Digging a bit more, I noticed that the matchers in the file_type function checks if the current file is a TestUnit file runs before it checks if the file is a RSpec file.

My issue is that RubyTest gets stuck in
elif re.search('test_\w+.rb', file_name):
partition_folder = self.find_partition_folder(file_name, RUBY_UNIT_FOLDER)
return BaseRubyTask.UnitFile(file_name, partition_folder)

i.e. if the file name has the string "test_" somewhere in the file, it's a TestUnit file.

In the settings file there are: {..."ruby_unit_folder": "test", "ruby_rspec_folder": "spec" ...}. I supposed that these folder names were used when matching runners. But at least as far as I've dug, it seems as if it's not done?

As a workaround, is there some way of disabling e.g. TestUnit/Shoulda from RubyTest?

@phawk
phawk commented Aug 27, 2014

+1 having this issue myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.