pezra / rspec-mode

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

Empty Rakefile breaks everything #135

Closed panjan closed 8 years ago

panjan commented 8 years ago

Hello, I tried to run tests on a project with an empty Rakefile and got the following output:

-*- mode: rspec-compilation; default-directory: "~/project/" -*-
RSpec Compilation started at Thu Jan  7 11:57:25

bundle exec rake spec SPEC_OPTS='--options ~/project/.rspec' SPEC='~/project/spec'

RSpec Compilation finished at Thu Jan  7 11:57:26

This is the minimal working Rakefile:

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

Things should work even with an empty Rakefile.

dgutov commented 8 years ago

How will we check whether Rakefile is a "working" one?

panjan commented 8 years ago

How about looking for the spec task in the output of rake --tasks --all?

dgutov commented 8 years ago

That would be pretty slow: first, we have to use bundle exec anyway. If Rakefile loads the environment, we'll basically incur the gem loading overhead twice.

In one of my work projects, that takes ~4 seconds. An sample Rails project: 2 seconds.

dgutov commented 8 years ago

Maybe the better choice would be to simply make rspec-use-rake-when-possible default to nil. I definitely had to use this value in the recent projects at works.

@pezra What do you think?

pezra commented 8 years ago

Hmm... it has the downside of breaking projects that do setup work in rake. (Eg, every rails project whenever there is a new migration.) Otoh, it would make individual test runs a bit, or a lot, faster.

I think I lean toward changing the default as @dgutov suggests because I rarely use rake to run specs these days. Even in rails projects. I'd be interested in hearing the views of others in the community, thoguh. (@rranelli, @pedz, @timcharper, @asok, @dgtized ,etc)

rranelli commented 8 years ago

I too never run "rake test" with rspec mode. I have set the option to ignore the Rakefile since my first day with rspec-mode I guess. On Jan 8, 2016 11:07 PM, "Peter Williams" notifications@github.com wrote:

Hmm... it has the downside of breaking projects that do setup work in rake. (Eg, every rails project whenever there is a new migration.) Otoh, it would make individual test runs a bit, or a lot, faster.

I think I lean toward changing the default as @dgutov https://github.com/dgutov suggests because I rarely use rake to run specs these days. Even in rails projects. I'd be interested in hearing the views of others in the community, thoguh. (@rranelli https://github.com/rranelli, @pedz https://github.com/pedz, @timcharper https://github.com/timcharper, @asok https://github.com/asok, @dgtized https://github.com/dgtized ,etc)

— Reply to this email directly or view it on GitHub https://github.com/pezra/rspec-mode/issues/135#issuecomment-170174191.

pedz commented 8 years ago

I also have it set to nil. I wrote what I call prvm which puts rspec with the bundled environment in my path so I can just say "rspec" and it is set up properly.