-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Rakefile
34 lines (27 loc) · 1.05 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
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
require "rubocop/rake_task"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
RuboCop::RakeTask.new
task :rails_test do
RAILS_TEST_DIR = "rails_test"
# TODO: By using Rails that includes https://github.com/rails/rails/pull/49247,
# the specification for 'Layout/EmptyLinesAroundBlockBody' becomes unnecessary.
EXCEPT_COPS = ["Layout/EmptyLinesAroundBlockBody", "Style/StringLiterals", "Style/FrozenStringLiteralComment"].freeze
sh "rails new #{RAILS_TEST_DIR} --skip-webpack-install"
cp "./test/fixture/.rubocop.yml", "#{RAILS_TEST_DIR}/.rubocop.yml"
cd RAILS_TEST_DIR do
# Rails generates files which have some rubocop
# offenses(StringLiterals, FrozenStringLiteralComment).
#
# Run rubocop and check there are no offenses except those rules.
sh "rubocop --except=#{EXCEPT_COPS.join(",")} ."
end
rm_rf RAILS_TEST_DIR
end
task default: [:test, :rubocop, :rails_test]