Sha256: 043f9a1c351e7f70dfcf9e81c408c56dfa8587a6bb8fae6f23a10e46b0de18a5

Contents?: true

Size: 736 Bytes

Versions: 7

Compression:

Stored size: 736 Bytes

Contents

require 'test_plugin_helper'

class ForemanRemoteExecutionForemanTasksCleanerExtensionsTest < ActiveSupport::TestCase
  it 'tries to delete associated job invocations' do
    job = FactoryGirl.create(:job_invocation, :with_task)
    ForemanTasks::Cleaner.new(:filter => "id = #{job.task.id}").delete
    JobInvocation.where(:id => job.id).must_be :empty?
  end

  it 'removes orphaned job invocations' do
    job = FactoryGirl.create(:job_invocation, :with_task)
    JobInvocation.where(:id => job.id).count.must_equal 1
    job.task.delete
    job.reload
    job.task.must_be :nil?
    job.task_id.wont_be :nil?
    ForemanTasks::Cleaner.new(:filter => 'id = 1').delete
    JobInvocation.where(:id => job.id).must_be :empty?
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
foreman_remote_execution-1.3.7 test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb
foreman_remote_execution-1.3.6 test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb
foreman_remote_execution-1.4.1 test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb
foreman_remote_execution-1.3.5 test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb
foreman_remote_execution-1.3.4 test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb
foreman_remote_execution-1.3.3 test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb
foreman_remote_execution-1.3.2 test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb