Skip to content

Commit 390d625

Browse files
committed
Fix Rubocop Performance/StringInclude offenses
1 parent e57c711 commit 390d625

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/puppet/type/sshkey.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def should
8585
if %r{\s}.match?(value)
8686
raise Puppet::Error, _('Aliases cannot include whitespace')
8787
end
88-
if %r{,}.match?(value)
88+
if value.include?(',')
8989
raise Puppet::Error, _('Aliases must be provided as an array, not a comma-separated list')
9090
end
9191
end

spec/acceptance/tests/resource/ssh_authorized_key/create_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
'drop_privileges=false',
6666
"target=/home/testuser/tmp/ssh_authorized_keys_#{name}/authorized_keys_#{name}"]
6767
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args)) do |_res|
68-
fail_test unless %r{the target path is not trusted}.match?(stderr)
68+
fail_test unless stderr.include?('the target path is not trusted')
6969
end
7070
on(agent, "rm -rf #{custom_key_directory}")
7171

@@ -81,7 +81,7 @@
8181
'drop_privileges=false',
8282
"target='#{custom_key}'"]
8383
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args), acceptable_exit_codes: [0, 1]) do |_res|
84-
fail_test unless %r{the target path is not trusted}.match?(stderr)
84+
fail_test unless stderr.include?('the target path is not trusted')
8585
end
8686
end
8787
end

0 commit comments

Comments
 (0)