-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
58 lines (50 loc) · 1.31 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
# frozen_string_literal: true
require 'solr_wrapper'
require 'fcrepo_wrapper'
require 'active_fedora/rake_support'
require 'bundler'
Bundler::GemHelper.install_tasks
# This is to fix a breaking change with Ruby 3.2 where some methods
# in fcrepo_wrapper use the removed `File.exists?` alias, preventing
# tests from being set up.
class File
class << self
alias exists? exist?
end
end
require 'rspec/core/rake_task'
desc 'Run tests only'
RSpec::Core::RakeTask.new(:rspec) do |spec|
spec.rspec_opts = ['--backtrace'] if ENV['CI']
end
require 'rubocop/rake_task'
desc 'Run style checker'
RuboCop::RakeTask.new(:rubocop) do |task|
task.requires << 'rubocop-rspec'
task.fail_on_error = true
end
RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.rcov = true
end
desc "CI build"
task :ci do
Rake::Task['rubocop'].invoke unless ENV['NO_RUBOCOP']
ENV['environment'] = "test"
with_test_server do
Rake::Task[:coverage].invoke
end
end
desc "Execute specs with coverage"
task :coverage do
# Put spec opts in a file named .rspec in root
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
ENV['COVERAGE'] = 'true' unless ruby_engine == 'jruby'
Rake::Task[:spec].invoke
end
desc "Execute specs with coverage"
task :spec do
with_test_server do
Rake::Task[:rspec].invoke
end
end
task default: :ci