Sha256: 303b290e01bce956b7fd5a0d2605ac62112cba2ea3bf0eac98baf4ae97e7cc7e

Contents?: true

Size: 967 Bytes

Versions: 11

Compression:

Stored size: 967 Bytes

Contents

require 'foreman_tasks_test_helper'

class TriggeringTest < ActiveSupport::TestCase

  describe 'validation' do
    it 'is valid when immediate' do
      FactoryGirl.build(:triggering).must_be :valid?
    end

    it 'is validates future execution' do
      triggering = FactoryGirl.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 = FactoryGirl.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 = FactoryGirl.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

11 entries across 11 versions & 1 rubygems

Version Path
foreman-tasks-0.8.6 test/unit/triggering_test.rb
foreman-tasks-0.8.5 test/unit/triggering_test.rb
foreman-tasks-0.8.4 test/unit/triggering_test.rb
foreman-tasks-0.8.3 test/unit/triggering_test.rb
foreman-tasks-0.8.2 test/unit/triggering_test.rb
foreman-tasks-0.8.1 test/unit/triggering_test.rb
foreman-tasks-0.8.0 test/unit/triggering_test.rb
foreman-tasks-0.7.20 test/unit/triggering_test.rb
foreman-tasks-0.7.19 test/unit/triggering_test.rb
foreman-tasks-0.7.18 test/unit/triggering_test.rb
foreman-tasks-0.7.17 test/unit/triggering_test.rb