3

What is it that rails spec does, if anything, that rspec alone does not?

I was looking for a way to run only specific RSpec tests from the command line, and the only way I found requires running rspec directly (rspec --tag focus ..., not via rails spec. I could do that, but I'm concerned that maybe doing so bypassing some important setup or other functionality.

Keith Bennett
  • 4,722
  • 1
  • 25
  • 35
  • Did you mean `rake spec` instead of `rails spec` ? – asimhashmi Dec 17 '19 at 10:19
  • 1
    `rake` would work, but I believe starting with Rails 5, `rails` is the preferred way to invoke `spec`, `db:migrate`, etc. See https://stackoverflow.com/questions/38403533/rails-dbmigrate-vs-rake-dbmigrate. – Keith Bennett Dec 17 '19 at 12:01

1 Answers1

2

It seems it calls rails test:prepare before actually calling rspec:

https://github.com/rspec/rspec-rails/blob/master/lib/rspec/rails/tasks/rspec.rake#L11

Marek Lipka
  • 50,622
  • 7
  • 87
  • 91