Sha256: e7e1a043227688d6ba2c6804521afa92cb616f51bb6fb4e7dd83b882f382764a
Contents?: true
Size: 917 Bytes
Versions: 8
Compression:
Stored size: 917 Bytes
Contents
require 'test_plugin_helper' class NewHostNotificationTest < ActiveSupport::TestCase test 'new discovered host should generate a notification' do assert blueprint FactoryGirl.create :discovered_host assert_equal 1, blueprint.notifications.count end test 'multiple discovered hosts should generate only one notification' do host1 = FactoryGirl.create :discovered_host ForemanDiscovery::UINotifications::NewHost.deliver!(host1) expired_at = blueprint.notifications.first.expired_at Time.any_instance.stubs(:utc).returns(expired_at + 1.hour) host2 = FactoryGirl.create :discovered_host ForemanDiscovery::UINotifications::NewHost.deliver!(host2) assert_equal 1, blueprint.notifications.count assert_not_equal expired_at, blueprint.notifications.first.expired_at end private def blueprint NotificationBlueprint.find_by(name: 'new_discovered_host') end end
Version data entries
8 entries across 8 versions & 1 rubygems