Ali Ashtiani
Ali Ashtiani

Reputation: 125

after upgrading RSpec to version 3 I can't run single spec file anymore

We are in the process of upgrading rails from 3.4 to 4.2. When we upgraded the rspec to the latest version, even after forcing the rspec to run only one spec it runs around 900 tests but my file only hast two contexts. I use something similar to this command :

rspec spec/myfile_spec.rb

What can be wrong? Is it something that I can fix in spec_helper? I d

Upvotes: 0

Views: 55

Answers (1)

Humayun Naseer
Humayun Naseer

Reputation: 460

Hope you are fine! You can just run the spec you want by the following commands.

# Default: Run all spec files (i.e., those matching spec/**/*_spec.rb)
$ bundle exec rspec

# Run all spec files in a single directory (recursively)
$ bundle exec rspec spec/models

# Run a single spec file
$ bundle exec rspec spec/controllers/accounts_controller_spec.rb

# Run a single example from a spec file (by line number)
$ bundle exec rspec spec/controllers/accounts_controller_spec.rb:8

# See all options for running specs
$ bundle exec rspec --help

Upvotes: 0

Related Questions