Rspec spec & Rake spec gives different result

2019-02-25 21:27发布

问题:

This seems to be mostly asked question, I have an application when run in both rake spec and rspec the output seems to be different. When rspec spec -p command is used 0 failures message is displayed while when rake spec is used few errors are displayed.

回答1:

When you run $ bundle exec rspec # (defaults to spec), all the files in the ./spec directory are executed.

When you run $ bundle exec rake spec, you're executing all of the rake tasks named 'spec' from all the gems and from their dependencies.

Also the environment under which tests are executed may vary accordingly to those files. Don't wonder if you face different outputs.