Skip to content

Commit

Permalink
Clean up test task definition
Browse files Browse the repository at this point in the history
This removes a layer of indirection, directly declaring the task,
instead of a task that defines a task when invoking.
  • Loading branch information
ekohl committed Jan 12, 2024
1 parent 808c1ac commit 02ca0a7
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/foreman_tasks/tasks/test.rake
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
namespace :test do
task :foreman_tasks => 'db:test:prepare' do
test_task = Rake::TestTask.new('foreman_tasks_test_task') do |t|
t.libs << ['test', "#{ForemanTasks::Engine.root}/test"]
t.pattern = ForemanTasks::Engine.root.join('test/**/*_test.rb')
t.test_files = [Rails.root.join('test/unit/foreman/access_permissions_test.rb')]
t.verbose = true
t.warning = false
end

Rake::Task[test_task.name].invoke
desc 'Foreman Tasks plugin tests'
Rake::TestTask.new(foreman_tasks: 'db:test:prepare') do |t|
t.libs << Rails.root.join('test')
t.libs << ForemanTasks::Engine.root.join('test')
t.pattern = ForemanTasks::Engine.root.join('test', '**', '*_test.rb')
t.test_files = [Rails.root.join('test', 'unit', 'foreman', 'access_permissions_test.rb')]
t.verbose = true
t.warning = false
end

desc 'Alias for test:foreman_tasks'
Expand Down

0 comments on commit 02ca0a7

Please sign in to comment.