Hi Myron,
thanks for your response, somehow not very helpful.
This does not seam to be the best solution, as these files
are under the directory spec/dummy/spec ( i.e a rails app called dummy using rspec ),
I would have to add a tag to any group example that I do not want rspec to run.
I believe this seams a bit redundant!?
The implementation I have in mind is to tell rspec not to require any file that matches
the path exception added.
Rspec::Core::Configuration#gather_directories returns the files that match a pattern
and sorts them.
My ideas is to add four more methods, and modify gather_directories to be like:
def initialize
@path_exceptions = false
end
attr_reader :path_exceptions
def gather_directories(path)
stripped = "{#{pattern.gsub(/\s*,\s*/, ',')}}"
files = pattern =~ /^#{Regexp.escape path}/ ? Dir[stripped] : Dir["#{path}/#{stripped}"]
except_for!(files)
end
def except_for!(files)
files = files.select { |file| file !~ path_exceptions } if path_exceptions
files.sort
end
def add_exception = path
@path_exceptions = path
end
alias :add_exceptions :add_exception
And you would add exceptions like so:
RSpec.configure do |c|
c.add_exception = /dummy/
# OR
c.add_exceptions = /dummy|app|test|sinatra/
end
In order not to use another loop in this minor implementation,
we would require users to follow that convention to specify more
than one path as an exception. ( i.e dummy|test|this, Ruby Regexp OR )
I got it working here, but as you Myron Marston does not seem to like this
implementation I would not even bother to open up a PR.
It's a minimal complexity added.
AFAIK anything has to start from somewhere, so here I am proposing this feature.
I am looking forward to hearing from you all.
With regards,
Nalesso Antonio