Skip to content

Instantly share code, notes, and snippets.

@curzonj
Created November 2, 2011 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curzonj/1333585 to your computer and use it in GitHub Desktop.
Save curzonj/1333585 to your computer and use it in GitHub Desktop.
customize the specs to run with a proc
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