pezra / rspec-mode

An RSpec minor mode for Emacs
258 stars 112 forks source link

Using rake spec doesn't exclude files #181

Open gcentauri opened 5 years ago

gcentauri commented 5 years ago

I could be doing something wrong here, but I have a set of spec files to be excluded and the rake spec task does that for me. Works fine from the terminal. However, when i set rspec-use-rake-when-possible to non-nil, it doesn't seem to work.

I can see it showing up as a cli option in the compilation buffer:

-*- mode: rspec-compilation; default-directory: "~/cardflight/core/" -*-
RSpec Compilation started at Wed Nov 28 13:24:23

bundle exec rake spec SPEC_OPTS='--options /Users/gshang/my/project/.rspec' SPEC='/Users/gshang/my/project/spec'
/Users/gshang/.rvm/rubies/ruby-2.3.6/bin/ruby -I/Users/gshang/.rvm/gems/ruby-2.3.6/gems/rspec-core-3.7.0/lib:/Users/gshang/.rvm/gems/ruby-2.3.6/gems/rspec-support-3.7.0/lib /Users/gshang/.rvm/gems/ruby-2.3.6/gems/rspec-core-3.7.0/exe/rspec /Users/gshang/my/project/spec --exclude-pattern spec/core/\{example,foo\}/\*\*/\*_spec.rb

But it hits the example and foo files that are intended to be excluded.

dgutov commented 5 years ago

Does the command above (printed to the compilation buffer) exclude the said files when run from the terminal?

gcentauri commented 5 years ago

It does not. It there's actually a newline there which I didn't realize, so the line with all the rvm info and the --exclude-pattern option doesn't become part of the command. If I try to smash it all on one line, it says that --exclude-pattern is an invalid option. If I set it not to use the rake command, that second line does not show up in the compilation buffer.

So it seems like something with either my Rakefile (which in regard to rspec just sets up the default :spec task with the exclude pattern set), or maybe something with RVM, or with how the command is being generated by rspec-mode is not working as expected?

dgutov commented 5 years ago

The second like is the command that that gets invoked by the first line (by Rake). I think.