up: rake to run all kind of specs
parent
f9de473ea4
commit
84e549bf58
|
@ -1 +1,6 @@
|
|||
language: ruby
|
||||
|
||||
script:
|
||||
- bundle exec rake spec
|
||||
- bundle exec rake spec_config
|
||||
- bundle exec rake spec_config_with_extra_scopes
|
||||
|
|
40
Rakefile
40
Rakefile
|
@ -6,10 +6,38 @@ 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')
|
||||
unsafe_path = ['', '/', '.', './'].include?(directory_config)
|
||||
|
||||
`mkdir -p #{directory_config}`
|
||||
|
||||
|
@ -21,13 +49,5 @@ task :spec_config do
|
|||
|
||||
Rake::Task['spec'].invoke
|
||||
|
||||
FileUtils.rm_rf(directory_config) unless unsafe_path
|
||||
end
|
||||
|
||||
desc 'Runs tests with and without config enabled'
|
||||
task :spec do
|
||||
Rake::Task['spec'].invoke
|
||||
Rake::Task['spec_config'].invoke
|
||||
|
||||
puts "Spec with and without config enabled executed."
|
||||
FileUtils.rm_rf(directory_config)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue