Sha256: d62dfa6057a0b395ba6f1fd1766be71348e70b27192a05b57092dca13a488344
Contents?: true
Size: 1.24 KB
Versions: 14
Compression:
Stored size: 1.24 KB
Contents
require 'test_plugin_helper' # Tests for the behavior of Host with roles, checks inheritance, etc class HostManagedExtensionsTest < ActiveSupport::TestCase before do @role1 = FactoryGirl.create(:ansible_role) @role2 = FactoryGirl.create(:ansible_role) @role3 = FactoryGirl.create(:ansible_role) @hostgroup_parent = FactoryGirl.create(:hostgroup, :ansible_roles => [@role2]) @hostgroup = FactoryGirl.create(:hostgroup, :parent => @hostgroup_parent) @host = FactoryGirl.build_stubbed(:host, :ansible_roles => [@role1]) end describe '#all_ansible_roles' do test 'returns assigned roles for host without a hostgroup' do @host.all_ansible_roles.must_equal [@role1] end test 'returns assigned and inherited roles for host with a hostgroup' do @host.hostgroup = @hostgroup @host.all_ansible_roles.must_equal [@role1, @role2] end end describe '#inherited_ansible_roles' do test 'returns empty array for host without hostgroup' do @host.inherited_ansible_roles.must_equal [] end test 'returns roles inherited from a hostgroup' do @host.hostgroup = @hostgroup @host.inherited_ansible_roles.must_equal [@role2] end end end
Version data entries
14 entries across 14 versions & 1 rubygems