Sha256: 19ac3a272d399e4c5824144f0db892a58265241a04f522fb2288c61c2bf1e396

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

require 'test_plugin_helper'

class DiscoveryTaxonomyExtensionsTest < ActiveSupport::TestCase
  setup do
    @facts = parse_json_fixture('/facts.json')['facts']
    set_default_settings
  end

  test 'deleting location does not hard fail if there is associated discovered host' do
    location = FactoryGirl.create(:location)

    assert (host = discover_host_from_facts(@facts))
    host.location = location
    assert host.save

    assert_nothing_raised do
      refute location.destroy, 'Location was destroyed but it should not be allowed'
    end
  end

  def parse_json_fixture(relative_path)
    return JSON.parse(File.read(File.expand_path(File.dirname(__FILE__) + relative_path)))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_discovery-10.0.0 test/unit/discovery_taxonomy_extensions_test.rb