Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #459 from kellyfelkins/master

Enable the spec task to traverse symlinked directories
  • Loading branch information...
commit a7a3f2a9f51ab2ed10aee133d4b26f406bec03cc 2 parents 50f8055 + a500cad
@dchelimsky dchelimsky authored
Showing with 32 additions and 1 deletion.
  1. +1 −1  lib/rspec/core/rake_task.rb
  2. +31 −0 spec/rspec/core/rake_task_spec.rb
View
2  lib/rspec/core/rake_task.rb
@@ -122,7 +122,7 @@ def initialize(*args)
@rcov_path ||= 'rcov'
@rspec_path ||= 'rspec'
- @pattern ||= './spec/**/*_spec.rb'
+ @pattern ||= './spec/**/*/**/*_spec.rb'
desc("Run RSpec code examples") unless ::Rake.application.last_comment
View
31 spec/rspec/core/rake_task_spec.rb
@@ -161,5 +161,36 @@ def spec_command
])
end
end
+
+ context "with paths including symlinked directories" do
+ it "finds the files" do
+ task = RakeTask.new
+ base_dir = File.expand_path('./tmp/base')
+ FileUtils.rm_rf base_dir
+
+ models_dir = File.expand_path('./tmp/base/spec/models')
+ FileUtils.rm_rf models_dir
+ FileUtils.mkdir_p models_dir
+ FileUtils.touch(File.join(models_dir, "any_model_spec.rb"))
+
+ target_parent_dir = File.expand_path('./tmp/target_parent_dir')
+ FileUtils.rm_rf target_parent_dir
+ FileUtils.mkdir_p target_parent_dir
+
+ target_dir = File.expand_path('./tmp/target_parent_dir/controllers')
+ FileUtils.rm_rf target_dir
+ FileUtils.mkdir_p target_dir
+ FileUtils.touch(File.join(target_dir, "any_controller_spec.rb"))
+
+ controllers_dir = File.expand_path('./tmp/base/spec/controllers')
+ FileUtils.ln_s target_dir, controllers_dir
+
+ File.exists?(controllers_dir).should be_true
+
+ FileUtils.cd(base_dir) do
+ task.__send__(:files_to_run).sort.should eq(["./spec/controllers/any_controller_spec.rb", "./spec/models/any_model_spec.rb"])
+ end
+ end
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.