forked from ddnexus/pagy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
93 lines (78 loc) · 2.97 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# encoding: utf-8
# frozen_string_literal: true
require "bundler/setup"
require "bundler/gem_tasks"
require "rake/testtask"
# The extras that override the built-in methods need to be tested in isolation in order
# to prevent them to change also the behavior and the result of the built-in tests.
# We exclude them from the :test_main task and create a new task for them, then added to the :default task
Rake::TestTask.new(:test_main) do |t|
t.libs += %w[test lib]
t.test_files = FileList.new.include("test/**/*_test.rb")
.exclude('test/**/headers_test.rb',
'test/**/i18n_test.rb',
'test/**/items_test.rb',
'test/**/overflow_test.rb',
'test/**/trim_test.rb',
'test/**/elasticsearch_rails_test.rb',
'test/**/searchkick_test.rb',
'test/**/support_test.rb',
'test/**/shared_test.rb',
'test/**/shared_combo_test.rb')
end
Rake::TestTask.new(:test_extra_headers) do |t|
t.libs += %w[test lib]
t.test_files = FileList['test/**/headers_test.rb']
end
Rake::TestTask.new(:test_extra_i18n) do |t|
t.libs += %w[test lib]
t.test_files = FileList['test/**/i18n_test.rb']
end
Rake::TestTask.new(:test_extra_items) do |t|
t.libs += %w[test lib]
t.test_files = FileList['test/**/items_test.rb']
end
Rake::TestTask.new(:test_extra_overflow) do |t|
t.libs += %w[test lib]
t.test_files = FileList['test/**/overflow_test.rb']
end
Rake::TestTask.new(:test_extra_trim) do |t|
t.libs += %w[test lib]
t.test_files = FileList['test/**/trim_test.rb']
end
Rake::TestTask.new(:test_extra_elasticsearch) do |t|
t.libs += %w[test lib]
t.test_files = FileList['test/**/elasticsearch_rails_test.rb', 'test/**/searchkick_test.rb']
end
Rake::TestTask.new(:test_support) do |t|
t.libs += %w[test lib]
t.test_files = FileList['test/**/support_test.rb']
end
Rake::TestTask.new(:test_shared) do |t|
t.libs += %w[test lib]
t.test_files = FileList['test/**/shared_test.rb']
end
Rake::TestTask.new(:test_shared_combo) do |t|
t.libs += %w[test lib]
t.test_files = FileList['test/**/shared_combo_test.rb']
end
task :test => [ :test_main,
:test_extra_items,
:test_extra_headers,
:test_extra_i18n,
:test_extra_overflow,
:test_extra_trim,
:test_extra_elasticsearch,
:test_support,
:test_shared,
:test_shared_combo ]
if ENV['RUN_RUBOCOP']
require "rubocop/rake_task"
RuboCop::RakeTask.new(:rubocop) do |t|
t.options = `git ls-files -z`.split("\x0") # limit rubocop to the files in the repo
t.requires << 'rubocop-performance'
end
task :default => [:test, :rubocop]
else
task :default => [:test]
end