Permalink
Browse files

Traverses symlinked directories when discovering specs.

  • Loading branch information...
1 parent 53513a6 commit 4a5d6edade75e651cffc12ff76406b059575eb7d @kevgo kevgo committed May 31, 2012
Showing with 21 additions and 1 deletion.
  1. +1 −1 lib/konacha.rb
  2. +20 −0 spec/konacha_spec.rb
View
2 lib/konacha.rb
@@ -33,7 +33,7 @@ def spec_root
end
def spec_paths
- Dir[File.join(spec_root, "**/*{_spec,_test}.*")].map do |path|
+ Dir[File.join(spec_root, "**{,/*/**}/*{_spec,_test}.*")].map do |path|
path.gsub(File.join(spec_root, ''), '')
end
end
View
20 spec/konacha_spec.rb
@@ -23,6 +23,26 @@
subject.should include("subdirectory/subdirectory_spec.js")
end
+ it "traverses symlinked directories" do
+ begin
+ # Create a directory with specs outside of 'spec/javascripts'.
+ Dir.mkdir "spec/dummy/app/external_specs"
+ File.new "spec/dummy/app/external_specs/my_spec.js", "w"
+
+ # Symlink it into 'spec/javascripts'.
+ File.symlink "../../app/external_specs/", "spec/dummy/spec/javascripts/external_specs"
+
+ subject.should include("external_specs/my_spec.js")
+
+ File.unlink "spec/dummy/spec/javascripts/external_specs"
+ rescue NotImplementedError
+ # Don't test this on platforms that don't support symlinking.
+ end
+
+ File.unlink "spec/dummy/app/external_specs/my_spec.js"
+ Dir.unlink "spec/dummy/app/external_specs"
+ end
+
it "does not include spec_helper" do
subject.should_not include("spec_helper.js")
end

0 comments on commit 4a5d6ed

Please sign in to comment.