Files
puppet-openstacklib/spec/functions/normalize_ip_for_uri_spec.rb
Sofer Athlan-Guyot af2aefbd74 Utility to handle IPv6 address brackets.
This add the function normalize_ip_for_uri to the parser.  It encloses
into brackets any valid IPv6 address thrown at it.

Change-Id: I093dd5a4e6294e20761cb3d33373652eeadeac36
Closes-bug: 1531960
2016-02-11 13:41:14 +01:00

14 lines
512 B
Ruby

require 'spec_helper'
describe 'normalize_ip_for_uri' do
it { should run.with_params(false).and_return(false)}
it { should run.with_params('not_an_ip').and_return('not_an_ip')}
it { should run.with_params('127.0.0.1').and_return('127.0.0.1')}
it { should run.with_params('::1').and_return('[::1]')}
it { should run.with_params('[2001::01]').and_return('[2001::01]')}
it do
is_expected.to run.with_params('one', 'two')
.and_raise_error(ArgumentError, /Wrong number of arguments/)
end
end