Skip to content

Instantly share code, notes, and snippets.

@pluto-atom-4
Created July 2, 2016 14:36
Show Gist options
  • Save pluto-atom-4/a5641f13dadb9f9a9379847d92bef173 to your computer and use it in GitHub Desktop.
Save pluto-atom-4/a5641f13dadb9f9a9379847d92bef173 to your computer and use it in GitHub Desktop.
require 'rake/testtask'
def functional_tests_excluding
items = FileList.new('test/functional/**/*_test.rb') do |f|
f.exclude('test/functional/**/delete_host*_test.rb')
f.exclude('test/functional/**/delete_contact*_test.rb')
end
if ENV['THESE']
exclusion_patterns = ENV['THESE'].split(',')
p items
p exclusion_patterns
items = items.select do |path|
excluded = exclusion_patterns.select { |excl| /#{excl}/.match(path) }
p "Excluding #{path}" if not excluded.empty?
excluded.empty?
end
end
items
end
functional_tests_delete_resoureces = ['test/functional/**/delete_host*_test.rb', 'test/functional/**/delete_contact*_test.rb']
namespace :test do
namespace :functional do
# you can run the task with additional exclusions like this
# rake -f functional_test.rake test:functional:excluding THESE="with_launch,epp_extensions"
Rake::TestTask.new(:excluding) do |t|
t.libs << "test"
t.options = "-v"
t.test_files = functional_tests_excluding
t.verbose = true
end
Rake::Task['test:functional:excluding'].comment = 'Run functional tests with exclusions'
Rake::TestTask.new(:delete_resources) do |t|
t.libs << "test"
t.options = "-v"
t.test_files = functional_tests_delete_resoureces
t.verbose = true
end
Rake::Task['test:functional:delete_resources'].comment = 'Run functional tests to validate pending deletes'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment