Skip to content

Enable the spec task to traverse symlinked directories

gitlab-qa-bot requested to merge github/fork/kellyfelkins/master into master

Created by: kellyfelkins

I encountered a problem when I split a project into a master git repo and a submodule, moving the model directory and associated model specs into the submodule. The models and model specs were symlinked into the appropriate places in the rails project. "rake" and "rake spec" would no longer find the model specs, though it would find specs that were not symlinked.

The spec rake task passes a pattern to rake, and rake uses Dir[pattern] to glob those files. Apparently Dir globbing with a "**" does not follow symlinks, at least not in the form of the original pattern.

The commit in this pull request includes a spec that checks that files are found in a directory structure that includes a sym link. This failed with the original pattern and passes with the modified pattern.

This resolves the issue I reported here:

https://github.com/rspec/rspec-rails/issues/442

-Kelly

Merge request reports