Sha256: cf81eb23b3c812a0813d7247128007d1871c6452bfd7a35ec7616a0386696151

Contents?: true

Size: 962 Bytes

Versions: 56

Compression:

Stored size: 962 Bytes

Contents

require 'foreman_tasks_test_helper'

class TriggeringTest < ActiveSupport::TestCase
  describe 'validation' do
    it 'is valid when immediate' do
      FactoryBot.build(:triggering).must_be :valid?
    end

    it 'is validates future execution' do
      triggering = FactoryBot.build(:triggering, :future)
      triggering.must_be :valid?
      triggering.start_before = triggering.start_at - 120
      triggering.wont_be :valid?
    end

    it 'is invalid when recurring logic is invalid' do
      triggering = FactoryBot.build(:triggering, :recurring)
      triggering.must_be :valid?
      triggering.recurring_logic.stubs(:valid?).returns(false)
      triggering.wont_be :valid?
    end
  end

  it 'cannot have mode set to arbitrary value' do
    triggering = FactoryBot.build(:triggering)
    triggering.must_be :valid?
    proc { triggering.mode = 'bogus' }.must_raise ArgumentError
    proc { triggering.mode = 27 }.must_raise ArgumentError
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
foreman-tasks-2.0.3 test/unit/triggering_test.rb
foreman-tasks-2.0.2 test/unit/triggering_test.rb
foreman-tasks-1.1.3 test/unit/triggering_test.rb
foreman-tasks-1.1.2 test/unit/triggering_test.rb
foreman-tasks-2.0.1 test/unit/triggering_test.rb
foreman-tasks-2.0.0 test/unit/triggering_test.rb
foreman-tasks-1.2.0 test/unit/triggering_test.rb
foreman-tasks-1.1.1 test/unit/triggering_test.rb
foreman-tasks-1.1.0 test/unit/triggering_test.rb
foreman-tasks-0.17.6 test/unit/triggering_test.rb
foreman-tasks-1.0.1 test/unit/triggering_test.rb
foreman-tasks-1.0.0 test/unit/triggering_test.rb
foreman-tasks-0.17.5 test/unit/triggering_test.rb
foreman-tasks-0.17.4 test/unit/triggering_test.rb
foreman-tasks-0.17.3 test/unit/triggering_test.rb
foreman-tasks-0.17.2 test/unit/triggering_test.rb
foreman-tasks-0.16.3 test/unit/triggering_test.rb
foreman-tasks-0.17.1 test/unit/triggering_test.rb
foreman-tasks-0.15.11 test/unit/triggering_test.rb
foreman-tasks-0.16.2 test/unit/triggering_test.rb