This repository has been archived by the owner on Feb 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
60 lines (46 loc) · 1.65 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
48
49
50
51
52
53
54
55
56
57
58
59
60
require 'rake'
require 'rspec/core/rake_task'
SPEC_SUITES = [
{ :id => :comp, :title => 'components', :pattern => %w(spec/components/*_spec.rb) },
{ :id => :type, :title => 'types', :pattern => %w(spec/type/*_spec.rb) },
{ :id => :validator, :title => 'validator', :pattern => %w(spec/validator/*_spec.rb) },
{ :id => :validation, :title => 'validation', :pattern => %w(spec/validation_*_spec.rb) },
{ :id => :doc, :title => 'model', :pattern => %w(spec/model_spec.rb) }
]
namespace :spec do
namespace :suite do
SPEC_SUITES.each do |suite|
desc "Run all specs in the '#{suite[:title]}' spec suite"
RSpec::Core::RakeTask.new(suite[:id], :format) do |t, args|
format = args[:format] || ''
t.pattern = suite[:pattern]
rspec_opts = ['--color', '--fail-fast']
rspec_opts << "--format #{format}" unless format.empty?
t.rspec_opts = rspec_opts
end
end
desc "Run all spec suites"
task :all, :format do |t, args|
format = args[:format] || ''
SPEC_SUITES.each do |suite|
Rake::Task["spec:suite:#{suite[:id]}"].invoke(format)
end
end
end
desc "Run all specs without splitting into suites"
RSpec::Core::RakeTask.new(:all, :format) do |t, args|
format = args[:format] || ''
t.pattern = %w(spec)
rspec_opts = ['--color', '--fail-fast']
rspec_opts << "--format #{format}" unless format.empty?
t.rspec_opts = rspec_opts
end
end
desc "Alias for spec:suite:all"
task :test do
Rake::Task["spec:all"].invoke("Fuubar")
end
desc "Alias for running spec:all with format=documentation"
task :doc do
Rake::Task["spec:all"].invoke("documentation")
end