Project

General

Profile

« Previous | Next » 

Revision 0b5f7acb

Added by Ori Rabin over 7 years ago

Fixes #17238 - Validates lookup value match exists in key path

View differences:

test/models/host_test.rb
test 'lookup values are copied' do
host = FactoryGirl.create(:host, :with_puppetclass)
FactoryGirl.create(:puppetclass_lookup_key, :as_smart_class_param, :with_override, :puppetclass => host.puppetclasses.first, :overrides => {host.lookup_value_matcher => 'test'})
FactoryGirl.create(:puppetclass_lookup_key, :as_smart_class_param, :with_override, :path => "fqdn\ncomment", :puppetclass => host.puppetclasses.first, :overrides => {host.lookup_value_matcher => 'test'})
copy = host.clone
assert_equal 1, host.lookup_values.reload.size
assert_equal 1, copy.lookup_values.size
......
test 'without save makes no changes' do
host = FactoryGirl.create(:host, :with_config_group, :with_puppetclass, :with_parameter)
FactoryGirl.create(:puppetclass_lookup_key, :as_smart_class_param, :with_override, :puppetclass => host.puppetclasses.first, :overrides => {host.lookup_value_matcher => 'test'})
FactoryGirl.create(:puppetclass_lookup_key, :as_smart_class_param, :with_override, :path => "fqdn\ncomment", :puppetclass => host.puppetclasses.first, :overrides => {host.lookup_value_matcher => 'test'})
ActiveRecord::Base.any_instance.expects(:destroy).never
ActiveRecord::Base.any_instance.expects(:save).never
host.clone

Also available in: Unified diff