-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathRakefile
53 lines (38 loc) · 1.08 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
# frozen_string_literal: true
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
task default: :spec
desc 'Runs tests with config enabled for extra scopes'
task :spec_config_with_extra_scopes do
directory_config = File.expand_path('config')
`mkdir -p #{directory_config}`
File.open(File.expand_path('config/rating.yml'), 'w+') do |file|
file.write %(
rating:
validations:
rate:
scope:
- author_type
- resource_id
- resource_type
- scopeable_id
- scopeable_type
- scope_1
- scope_2
)
end
ENV['CONFIG_ENABLED_WITH_EXTRA_SCOPES'] = 'true'
Rake::Task['spec'].invoke
FileUtils.rm_rf(directory_config)
end
desc 'Runs tests with config enabled'
task :spec_config do
directory_config = File.expand_path('config')
`mkdir -p #{directory_config}`
File.open(File.expand_path('config/rating.yml'), 'w+') do |file|
file.write "rating:\n rate_table: 'reviews'\n rating_table: 'review_ratings'"
end
ENV['CONFIG_ENABLED'] = 'true'
Rake::Task['spec'].invoke
FileUtils.rm_rf(directory_config)
end