From 763c8707d22d1d66d8b767612682ddd0a84b51b0 Mon Sep 17 00:00:00 2001 From: Dinesh Gujar Date: Wed, 2 Aug 2023 14:13:47 +0530 Subject: [PATCH] CAT-1147 erb to epp conversion linting fix --- .rubocop_todo.yml | 1 + .../functions/mysql_innobackupex_args_spec.rb | 38 ++++++++++--------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4aca98123..f962f9fa7 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -95,6 +95,7 @@ RSpec/NamedSubject: - 'spec/classes/mysql_server_spec.rb' - 'spec/defines/mysql_db_spec.rb' - 'spec/functions/mysql_normalise_and_deepmerge_spec.rb' + - 'spec/functions/mysql_innobackupex_args_spec.rb' - 'spec/functions/mysql_strip_hash_spec.rb' # Offense count: 45 diff --git a/spec/functions/mysql_innobackupex_args_spec.rb b/spec/functions/mysql_innobackupex_args_spec.rb index 8dad6dd45..36be79ca7 100644 --- a/spec/functions/mysql_innobackupex_args_spec.rb +++ b/spec/functions/mysql_innobackupex_args_spec.rb @@ -11,37 +11,41 @@ expect(subject).to run.with_params('', true, '', [], []) end - it 'returns args with username and password' do - expect(subject).to run.with_params('root', false, '12345', [], []).and_return('--user="root" --password="12345"') - end + context 'should work with username and password' do + it 'returns args with username and password' do + expect(subject).to run.with_params('root', false, '12345', [], []).and_return('--user="root" --password="12345"') + end + + it 'returns args with database lists' do + expect(subject).to run.with_params('root', false, '12345', ['db1', 'db2'], []).and_return('--user="root" --password="12345" --databases="db1 db2"') + end - it 'returns args with database lists' do - expect(subject).to run.with_params('root', false, '12345', ['db1', 'db2'], []).and_return('--user="root" --password="12345" --databases="db1 db2"') + it 'returns args with backup compress only' do + expected_results = '--user="root" --password="12345" --compress' + expect(subject).to run.with_params('root', true, '12345', [], []).and_return(expected_results) + end + + it 'returns args with backup compress, database list and optional_args' do + expected_results = '--user="root" --password="12345" --compress --databases="db1 db2" tst_arg_1 tst_arg_2' + expect(subject).to run.with_params('root', true, '12345', ['db1', 'db2'], ['tst_arg_1', 'tst_arg_2']).and_return(expected_results) + end end - it 'returns args without database list' do - expect(subject).to run.with_params('root', false, '12345', [], []).and_return('--user="root" --password="12345"') + context 'should work without database args' do + it 'returns args without database list' do + expect(subject).to run.with_params('root', false, '12345', [], []).and_return('--user="root" --password="12345"') + end end it 'returns args without backup compress' do expect(subject).to run.with_params('root', false, '12345', [], []).and_return('--user="root" --password="12345"') end - it 'returns args with backup compress only' do - expected_results = '--user="root" --password="12345" --compress' - expect(subject).to run.with_params('root', true, '12345', [], []).and_return(expected_results) - end - it 'returns args with backup compress and database list' do expected_results = '--user="root" --password="12345" --compress --databases="db1 db2"' expect(subject).to run.with_params('root', true, '12345', ['db1', 'db2'], []).and_return(expected_results) end - it 'returns args with backup compress, database list and optional_args' do - expected_results = '--user="root" --password="12345" --compress --databases="db1 db2" tst_arg_1 tst_arg_2' - expect(subject).to run.with_params('root', true, '12345', ['db1', 'db2'], ['tst_arg_1', 'tst_arg_2']).and_return(expected_results) - end - it 'returns args without backup compress database list and optional_args' do expected_results = '--user="root" --password="12345" --databases="db1 db2" tst_arg_1 tst_arg_2' expect(subject).to run.with_params('root', false, '12345', ['db1', 'db2'], ['tst_arg_1', 'tst_arg_2']).and_return(expected_results)