diff --git a/src/lib/registration/ui/offline_migration_workflow.rb b/src/lib/registration/ui/offline_migration_workflow.rb index 003c837bd..23f742895 100644 --- a/src/lib/registration/ui/offline_migration_workflow.rb +++ b/src/lib/registration/ui/offline_migration_workflow.rb @@ -19,6 +19,9 @@ module UI # This class handles offline migration workflow, # it is a wrapper around "migration_repos" client class OfflineMigrationWorkflow + include Yast::I18n + include Yast::Logger + # the constructor def initialize textdomain "registration" diff --git a/test/offline_migration_workflow_test.rb b/test/offline_migration_workflow_test.rb new file mode 100644 index 000000000..c26b075f3 --- /dev/null +++ b/test/offline_migration_workflow_test.rb @@ -0,0 +1,34 @@ +#! /usr/bin/env rspec + +require_relative "spec_helper" + +describe Registration::UI::OfflineMigrationWorkflow do + describe "#main" do + it "runs the 'migration_repos' client" do + expect(Yast::WFM).to receive(:CallFunction).with("migration_repos", anything) + subject.main + end + + it "returns the 'migration_repos' result" do + expect(Yast::WFM).to receive(:CallFunction).with("migration_repos", anything).and_return(:foo) + expect(subject.main).to eq(:foo) + end + + context "the 'migration_repos' client returns :rollback" do + before do + expect(Yast::WFM).to receive(:CallFunction).with("migration_repos", anything) + .and_return(:rollback) + allow(Yast::WFM).to receive(:CallFunction).with("registration_sync") + end + + it "runs the 'registration_sync' client" do + expect(Yast::WFM).to receive(:CallFunction).with("registration_sync") + subject.main + end + + it "return :back" do + expect(subject.main).to eq(:back) + end + end + end +end