forked from dry-rb/dry-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
executable file
·47 lines (32 loc) · 1.25 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env rake
# frozen_string_literal: true
require 'bundler/gem_tasks'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
require 'rspec/core'
require 'rspec/core/rake_task'
require 'dry/validation'
RSpec::Core::RakeTask.new(:spec)
extensions = Dir['./spec/extensions/*'].map { |path| Pathname(path).basename.to_s.to_sym }
desc 'Run only core specs without extensions specs'
RSpec::Core::RakeTask.new('spec:core') do |t|
t.rspec_opts = 'spec/unit spec/integration --pattern **/*_spec.rb'
end
extensions.each do |ext|
desc "Run all specs with #{ext} enabled"
RSpec::Core::RakeTask.new("spec:#{ext}") do |t|
puts "Running specs with #{ext.inspect} enabled"
Dry::Validation.load_extensions(ext)
t.rspec_opts = "spec/unit spec/integration spec/extensions/#{ext} --pattern **/*_spec.rb"
end
end
desc 'Run all specs with all extensions enabled'
task 'spec:extensions' do
puts "Loading extensions: #{extensions.inspect}"
Dry::Validation.load_extensions(*extensions)
Rake::Task[:spec].invoke
end
desc 'Run all specs in isolation with extension enabled'
task 'spec:isolation' => ['spec:core', *extensions.map { |ext| "spec:#{ext}" }]
desc 'Run CI build'
task ci: %w[spec:core spec:isolation spec:extensions]
task default: :ci