Created
November 2, 2011 13:13
-
-
Save curzonj/1333585 to your computer and use it in GitHub Desktop.
customize the specs to run with a proc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec::Core::RakeTask.class_eval do | |
def reject_patterns(&block) | |
@reject_patterns = block | |
end | |
private | |
def files_to_run | |
if ENV['SPEC'] | |
FileList[ ENV['SPEC'] ] | |
else | |
list = FileList[ pattern ].map { |f| f.gsub(/"/, '\"').gsub(/'/, "\\\\'") } | |
list = list.reject {|f| @reject_patterns.call(f) } if @reject_patterns | |
list | |
end | |
end | |
end | |
# We don't want to run request specs with the rest | |
Rake::Task[:spec].actions.clear | |
RSpec::Core::RakeTask.new(:spec => "db:test:prepare") do |t| | |
t.reject_patterns {|file| file =~ /spec\/requests/ } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment