Skip to content

Commit

Permalink
Fix tests due to updating the dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Helen Campbell committed Nov 28, 2017
2 parents accfd0f + 1ed9bbd commit 4a14684
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/pdk/cli/convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module PDK::CLI
end

unless opts[:noop] || opts[:force]
PDK.logger.info _('This is a potentially destructive action. Please ensure that you have committed it to a version control system or have a backup before continuing.')
exit 0 unless PDK::CLI::Util.prompt_for_yes(_('Do you want to continue converting this module?'))
PDK.logger.info _('Module conversion is a potentially destructive action. Please ensure that you have committed it to a version control system or have a backup before continuing.')
exit 0 unless PDK::CLI::Util.prompt_for_yes(_('Do you want to proceed with conversion?'))
end

PDK::Module::Convert.invoke(opts)
Expand Down
8 changes: 4 additions & 4 deletions spec/unit/pdk/cli/convert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
context 'and provided no flags' do
before(:each) do
allow(logger).to receive(:info).with(backup_warning)
allow(PDK::CLI::Util).to receive(:prompt_for_yes).with(a_string_matching(%r{do you want to continue}i)).and_return(true)
allow(PDK::CLI::Util).to receive(:prompt_for_yes).with(a_string_matching(%r{Do you want to proceed with conversion?}i)).and_return(true)
end

it 'asks the user if they want to continue' do
expect(logger).to receive(:info).with(backup_warning)
expect(PDK::CLI::Util).to receive(:prompt_for_yes).with(a_string_matching(%r{do you want to continue}i)).and_return(true)
expect(PDK::CLI::Util).to receive(:prompt_for_yes).with(a_string_matching(%r{Do you want to proceed with conversion?}i)).and_return(true)
allow(PDK::Module::Convert).to receive(:invoke).with(any_args).and_return(0)

PDK::CLI.run(%w[convert])
end

it 'exits cleanly if the user chooses not to continue' do
allow(PDK::CLI::Util).to receive(:prompt_for_yes).with(a_string_matching(%r{do you want to continue}i)).and_return(false)
allow(PDK::CLI::Util).to receive(:prompt_for_yes).with(a_string_matching(%r{Do you want to proceed with conversion?}i)).and_return(false)
expect(PDK::Module::Convert).not_to receive(:invoke)

expect {
Expand All @@ -60,7 +60,7 @@
context 'and the --template-url option has been passed' do
before(:each) do
allow(logger).to receive(:info).with(backup_warning)
allow(PDK::CLI::Util).to receive(:prompt_for_yes).with(a_string_matching(%r{do you want to continue}i)).and_return(true)
allow(PDK::CLI::Util).to receive(:prompt_for_yes).with(a_string_matching(%r{Do you want to proceed with conversion?}i)).and_return(true)
end

it 'invokes the converter with the user supplied template' do
Expand Down

0 comments on commit 4a14684

Please sign in to comment.