Revision ea740cfe
Added by Ori Rabin about 8 years ago
app/models/lookup_keys/lookup_key.rb | ||
---|---|---|
end
|
||
|
||
def to_param
|
||
Parameterizable.parameterize("#{id}-#{key}")
|
||
# to_param is used in views to create a link to the lookup_key.
|
||
# If the key has whitespace in it the link will break so this replaced the whitespace.
|
||
search_key = key.tr(' ','_') unless key.nil?
|
||
Parameterizable.parameterize("#{id}-#{search_key}")
|
||
end
|
||
|
||
def to_s
|
test/unit/lookup_key_test.rb | ||
---|---|---|
end
|
||
end
|
||
|
||
test "to_param should replace whitespace with underscore" do
|
||
lookup_key = VariableLookupKey.new(:key => "smart variable", :path => "hostgroup", :puppetclass => Puppetclass.first, :default_value => "default")
|
||
assert_equal "-smart_variable", lookup_key.to_param
|
||
end
|
||
|
||
test "when changed, an audit entry should be added" do
|
||
env = FactoryGirl.create(:environment)
|
||
pc = FactoryGirl.create(:puppetclass, :with_parameters, :environments => [env])
|
Also available in: Unified diff
Fixes #14183 - showing whitespace validation in smart variables