Closed asusikov closed 9 years ago
Same issue. I am using the obvious workaround of adding my rspec commands in the settings for minitest.
@asusikov, @drogar: At the top of a typical spec file, do you include a spec helper, like this:
require 'spec_helper'
Or do you do something different to bootstrap RSpec?
I do.
Usually
require ‘rails_helper’
or
require ‘spec_helper’
I noticed the issue on one of the files with require ‘rails helper’
On May 25, 2015, at 10:12 AM, Moxley Stratton notifications@github.com wrote:
@asusikov https://github.com/asusikov, @drogar https://github.com/drogar: At the top of a typical spec file, do you include a spec helper, like this:
require 'spec_helper' Or do you do something different to bootstrap RSpec?
— Reply to this email directly or view it on GitHub https://github.com/moxley/atom-ruby-test/issues/54#issuecomment-105258714.
I do too.
OK, give this fix a shot.
Perfect. Works for me.
Thanks for such a quick turnaround!
On May 25, 2015, at 10:34 AM, Moxley Stratton notifications@github.com wrote:
OK, give this fix a shot.
— Reply to this email directly or view it on GitHub https://github.com/moxley/atom-ruby-test/issues/54#issuecomment-105263767.
It works for me too. Thank you for your quick fix!
@drogar, @asusikov Thanks for the feedback!
What about if you use a relative path:
require File.dirname(__FILE__) + '/../../spec_helper'
I do this for files where I want to run tests without rails environment (but with rspec). Just using require 'spec_helper'
doesn't work in this case.
Therefore the plugin is inconsistent with detecting rspec and sometimes (for the same file) it ends up running minitest instead.
What other alternatives to conventions for deteting rspec tests are? I would presume that you can look at the file name and it should end with _spec.rb
. Or at least it could give us the possiblity of choosing the default test command for a project.
@zinkkrysty: Detecting spec framework is difficult and error-prone. ruby-test has a setting for choosing your preferred spec framework. Change it to rspec
if that is your preferred framework. If you use minitest on some projects and rspec on others, install the https://github.com/danielbrodin/atom-project-manager plugin, then configure each project with it to set the ruby-test preferred spec framework.
Ok thanks for the info. I agree, it shouldn't hack its way into detecting the right framework, if there isn't an established convention.
I'll take your suggestion with the preferred framework and the project-manager plugin, I didn't know about that.
Hm, detection seems to be failing on my project too.
I don't quite understand what's so hard about determining if it's an rspec project... If an .rspec
file exists in the project's root dir, or if spec/spec_helper.rb
includes RSpec.configure
, then it has to be rspec, no?
Would you accept a PR to improve this?
@bronson: There is logic in https://github.com/moxley/atom-ruby-test/blob/master/lib/source-info.coffee#L124 that checks for an .rspec
file. Maybe you can identify the proper course of action to fix the problem.
Of course I accept PRs: https://github.com/moxley/atom-ruby-test#contributing
After updating to 0.9.8 rspec files are running by commands for minitest files.