I wrote some new specs in a file called, spec/requests/schedule_revise_button_next_day.rb,
and was able to test the specs (red to green) so long as I ran that file alone with:
$ rspec spec/requests/schedule_revise_button_next_day.rb
When I ran all of my specs, however, with $ rspec spec/
, that file would get skipped. The specs wouldn't be run. To test running the file with other spec files, I tried renaming the file with different prefixes like a_schedule_revise_button_next_day.rb
and then running commands like:
$ rspec spec/requests/a*
That file would still get skipped though the other a*
files would run.
I also isolated the problem to the file name since I was able to get the specs to run when I cut and pasted them into other files. I also was able to replicate the problem on two separate computers with different hardware and OS (OSX and Ubuntu.)
Only when I changed the file name to schedule_revise_spec.rb
would it not be skipped when I ran it with all of my other specs. This situation makes me nervous in that I almost didn't realize that these specs were not being run. Anyone know what the problem is with my original file name? I'd be very grateful for any thoughts anyone has.
Best, Ben
When given a directory or file pattern on the command line, RSpec looks for files ending in _spec
. See How can I get Rspec to run all tests nested under a folder? for more discussion.