Sha256: 635fe02721b6fabac22107658969208a88fef31a82d4e4c2df2853007cccdff1

Contents?: true

Size: 992 Bytes

Versions: 9

Compression:

Stored size: 992 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

9 entries across 9 versions & 1 rubygems

Version Path
foreman-tasks-3.0.6 test/unit/triggering_test.rb
foreman-tasks-4.0.1 test/unit/triggering_test.rb
foreman-tasks-3.0.5 test/unit/triggering_test.rb
foreman-tasks-4.0.0 test/unit/triggering_test.rb
foreman-tasks-3.0.4 test/unit/triggering_test.rb
foreman-tasks-3.0.3 test/unit/triggering_test.rb
foreman-tasks-3.0.2 test/unit/triggering_test.rb
foreman-tasks-3.0.1 test/unit/triggering_test.rb
foreman-tasks-3.0.0 test/unit/triggering_test.rb