Reputation: 2289
I want to specify certain folders in my take task using the pattern
method.
At the minute my code looks like:
RSpec::Core::RakeTask.new do |t|
t.pattern = "spec/models/*_spec.rb"
end
So the code above will load all spec files in the models
folder.
How could I change this to include the controllers
folder, and helpers
folder (for example).
So I want to create a FileList
of all *_spec.rb
files in the models, controllers and helpers spec folders (AND subfolders)
Upvotes: 1
Views: 260
Reputation: 2090
I believe the pattern is an array, so you can use the <<
operator to append new patterns. For example
RSpec::Core::RakeTask.new do |t|
t.pattern << "spec/models/*_spec.rb"
t.pattern << "spec/controllers/*_spec.rb"
end
If you only want to run a specific list without the defaults just assign an array:
RSpec::Core::RakeTask.new do |t|
t.pattern = ["spec/models/*_spec.rb", "spec/controllers/*_spec.rb"]
end
Upvotes: 1