3 describe 'validate_email_address' do
4 describe 'signature validation' do
5 it { is_expected.not_to eq(nil) }
6 it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
9 describe 'valid inputs' do
10 it { is_expected.to run.with_params('bob@gmail.com') }
11 it { is_expected.to run.with_params('alice+puppetlabs.com@gmail.com') }
14 describe 'invalid inputs' do
15 it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, %r{is not a string}) }
16 it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, %r{is not a string}) }
17 it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, %r{is not a string}) }
18 it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError, %r{is not a valid email}) }
19 it { is_expected.to run.with_params('bob@gmail.com', {}).and_raise_error(Puppet::ParseError, %r{is not a string}) }
20 it { is_expected.to run.with_params('bob@gmail.com', true).and_raise_error(Puppet::ParseError, %r{is not a string}) }
21 it { is_expected.to run.with_params('bob@gmail.com', 'one').and_raise_error(Puppet::ParseError, %r{is not a valid email}) }