Skip to content

Commit b92d40f

Browse files
committed
address rubocop
1 parent 2bc8823 commit b92d40f

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

lib/puppet/functions/length.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,9 @@
44
scope_param
55
optional_repeated_param 'Any', :args
66
end
7-
def length(value)
8-
if value.is_a?(String)
9-
result = value.length
10-
elsif value.is_a?(Array) || value.is_a?(Hash)
11-
result = value.size
12-
end
13-
result
7+
148
def deprecation_gen(scope, *args)
15-
call_function('deprecation', 'length', "This method is deprecated, this function is now shipped with Puppet in versions 5.5.0 and later. For more information please see Puppet 5.5.0 Release Notes.")
16-
scope.send("function_length", args)
9+
call_function('deprecation', 'length', 'This method is deprecated, this function is now shipped with Puppet in versions 5.5.0 and later. For more information please see Puppet 5.5.0 Release Notes.') # rubocop:disable Metrics/LineLength
10+
scope.send('function_length', args)
1711
end
1812
end

spec/functions/keys_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) } if Puppet.version < '5.5.0'
1313
it { is_expected.to run.with_params({}).and_return([]) }
1414
it { is_expected.to run.with_params('key' => 'value').and_return(['key']) }
15-
it 'returns the array of keys', if: Puppet.version < '5.5.0' do
15+
it 'returns the array of keys', :if => Puppet.version < '5.5.0' do
1616
result = subject.call([{ 'key1' => 'value1', 'key2' => 'value2' }])
1717
expect(result).to match_array(%w[key1 key2])
1818
end
1919

20-
it 'runs with UTF8 and double byte characters', if: Puppet.version < '5.5.0' do
20+
it 'runs with UTF8 and double byte characters', :if => Puppet.version < '5.5.0' do
2121
result = subject.call([{ 'ҝểү' => '√ẳŀμệ', 'キー' => '値' }])
2222
expect(result).to match_array(%w[ҝểү キー])
2323
end

spec/functions/values_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) } if Puppet.version < '5.5.0'
1313
it { is_expected.to run.with_params({}).and_return([]) }
1414
it { is_expected.to run.with_params('key' => 'value').and_return(['value']) }
15-
it 'returns the array of values', if: Puppet.version < '5.5.0' do
15+
it 'returns the array of values', :if => Puppet.version < '5.5.0' do
1616
result = subject.call([{ 'key1' => 'value1', 'key2' => 'value2', 'duplicate_value_key' => 'value2' }])
1717
expect(result).to match_array(%w[value1 value2 value2])
1818
end
1919

20-
it 'runs with UTF8 and double byte characters', if: Puppet.version < '5.5.0' do
20+
it 'runs with UTF8 and double byte characters', :if => Puppet.version < '5.5.0' do
2121
result = subject.call([{ 'かぎ' => '使用', 'ҝĕұ' => '√ẩŀứệ', 'ҝĕұďŭрļǐçằťè' => '√ẩŀứệ' }])
2222
expect(result).to match_array(['使用', '√ẩŀứệ', '√ẩŀứệ'])
2323
end

spec/spec_helper_acceptance.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
install_module_on(hosts)
99
install_module_dependencies_on(hosts)
1010

11-
def return_puppet_version
12-
(on default, puppet('--version')).output.chomp
13-
end
14-
1511
RSpec.configure do |c|
1612
# Readable test descriptions
1713
c.formatter = :documentation

0 commit comments

Comments
 (0)