Skip to content

Commit e14be6b

Browse files
committed
rubocop fixes
1 parent e1a7b8c commit e14be6b

File tree

2 files changed

+32
-37
lines changed

2 files changed

+32
-37
lines changed

lib/puppet/functions/mysql/mysql_password.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,13 @@
3232
repeated_param 'Any', :args
3333
end
3434

35-
3635
def default_impl(*args)
37-
38-
3936
if args.size != 1
4037
raise Puppet::ParseError, _('mysql_password(): Wrong number of arguments given (%{args_length} for 1)') % { args_length: args.length }
4138
end
4239

4340
return '' if args[0].empty?
4441
return args[0] if args[0] =~ %r{\*[A-F0-9]{40}$}
4542
'*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(args[0])).upcase
46-
4743
end
4844
end

spec/functions/mysql_mysql_password_spec.rb

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,36 @@
55
# case that we can autogenerate. You should add more examples below!
66
it { is_expected.not_to eq(nil) }
77

8-
#################################
9-
# Below are some example test cases. You may uncomment and modify them to match
10-
# your needs. Notice that they all expect the base error class of `StandardError`.
11-
# This is because the autogenerated function uses an untyped array for parameters
12-
# and relies on your implementation to do the validation. As you convert your
13-
# function to proper dispatches and typed signatures, you should change the
14-
# expected error of the argument validation examples to `ArgumentError`.
15-
#
16-
# Other error types you might encounter include
17-
#
18-
# * StandardError
19-
# * ArgumentError
20-
# * Puppet::ParseError
21-
#
22-
# Read more about writing function unit tests at https://rspec-puppet.com/documentation/functions/
23-
#
24-
# it 'raises an error if called with no argument' do
25-
# is_expected.to run.with_params.and_raise_error(StandardError)
26-
# end
27-
#
28-
# it 'raises an error if there is more than 1 arguments' do
29-
# is_expected.to run.with_params({ 'foo' => 1 }, 'bar' => 2).and_raise_error(StandardError)
30-
# end
31-
#
32-
# it 'raises an error if argument is not the proper type' do
33-
# is_expected.to run.with_params('foo').and_raise_error(StandardError)
34-
# end
35-
#
36-
# it 'returns the proper output' do
37-
# is_expected.to run.with_params(123).and_return('the expected output')
38-
# end
39-
#################################
40-
8+
#################################
9+
# Below are some example test cases. You may uncomment and modify them to match
10+
# your needs. Notice that they all expect the base error class of `StandardError`.
11+
# This is because the autogenerated function uses an untyped array for parameters
12+
# and relies on your implementation to do the validation. As you convert your
13+
# function to proper dispatches and typed signatures, you should change the
14+
# expected error of the argument validation examples to `ArgumentError`.
15+
#
16+
# Other error types you might encounter include
17+
#
18+
# * StandardError
19+
# * ArgumentError
20+
# * Puppet::ParseError
21+
#
22+
# Read more about writing function unit tests at https://rspec-puppet.com/documentation/functions/
23+
#
24+
# it 'raises an error if called with no argument' do
25+
# is_expected.to run.with_params.and_raise_error(StandardError)
26+
# end
27+
#
28+
# it 'raises an error if there is more than 1 arguments' do
29+
# is_expected.to run.with_params({ 'foo' => 1 }, 'bar' => 2).and_raise_error(StandardError)
30+
# end
31+
#
32+
# it 'raises an error if argument is not the proper type' do
33+
# is_expected.to run.with_params('foo').and_raise_error(StandardError)
34+
# end
35+
#
36+
# it 'returns the proper output' do
37+
# is_expected.to run.with_params(123).and_return('the expected output')
38+
# end
39+
#################################
4140
end

0 commit comments

Comments
 (0)