rspec-mode icon indicating copy to clipboard operation
rspec-mode copied to clipboard

Using rake spec doesn't exclude files

Open gcentauri opened this issue 7 years ago • 3 comments

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.

gcentauri avatar Nov 28 '18 19:11 gcentauri

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

dgutov avatar Nov 28 '18 21:11 dgutov

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?

gcentauri avatar Nov 29 '18 18:11 gcentauri

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

dgutov avatar Nov 29 '18 21:11 dgutov