Skip to content

Commit

Permalink
Merge a7f2d15 into 80b8040
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jul 1, 2015
2 parents 80b8040 + a7f2d15 commit 6984076
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# use the shared Yast defaults
inherit_from:
/usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml

Style/MethodName:
Exclude:
# the mocked Update module methods break the Ruby naming rule
- test/main_workflow_test.rb
13 changes: 9 additions & 4 deletions src/lib/migration/main_workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,18 @@ def restore_state
end

def repositories
ret = Yast::WFM.CallFunction("repositories")
Yast::Pkg.SourceLoad if ret != :abort

ret
Yast::WFM.CallFunction("migration_repos")
end

def proposals
# HACK: disable updating from _all_ repositories in update_proposal.rb
# client, pretend that the initialization has been already done
Yast::Update.did_init1 = true

# update only installed packages, updated based on patterns is used for
# product version upgrade (e.g. SLES11 -> SLES12)
Yast::Update.onlyUpdateInstalled = true

Yast::WFM.CallFunction("migration_proposals", [{ "hide_export" => true }])
end

Expand Down
2 changes: 1 addition & 1 deletion src/lib/migration/proposal_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ProposalStore < Installation::ProposalStore
include Yast::Logger
include Yast::I18n

PROPOSAL_NAMES = ["update_proposal"]
PROPOSAL_NAMES = ["update_proposal", "packages_proposal"]
PROPOSAL_PROPERTIES = {
"enable_skip" => "false"
}
Expand Down
14 changes: 5 additions & 9 deletions test/main_workflow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
module Yast
# Faked Update module
class UpdateClass
# we need at least one non-default methods, otherwise ruby-bindings thinks
# it is just namespace
def fake_method
def did_init1=(_init)
end

def onlyUpdateInstalled=(_mode)
end
end
Update = UpdateClass.new
Expand All @@ -41,7 +42,7 @@ def mock_client(name, res)
end

before do
mock_client("repositories", :next)
mock_client("migration_repos", :next)
mock_client(["migration_proposals", [{ "hide_export" => true }]], :next)
mock_client("inst_prepareprogress", :next)
mock_client("inst_kickoff", :next)
Expand All @@ -65,11 +66,6 @@ def mock_client(name, res)
expect(::Migration::MainWorkflow.run).to eq :next
end

it "reload sources if click next on repositories" do
expect(Yast::Pkg).to receive(:SourceLoad)
::Migration::MainWorkflow.run
end

it "restores repositories when clicking on Cancel" do
expect(Yast::Update).to receive(:clean_backup)
expect(Yast::Update).to receive(:create_backup)
Expand Down
6 changes: 4 additions & 2 deletions test/proposal_store_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ module Yast

describe ".proposal_names" do
it "returns an update proposal" do
expect(subject.proposal_names).to eq ["update_proposal"]
expect(subject.proposal_names).to eq ["update_proposal",
"packages_proposal"]
end
end

describe ".presentation_order" do
it "returns a presentation order" do
expect(subject.presentation_order).to eq ["update_proposal"]
expect(subject.presentation_order).to eq ["update_proposal",
"packages_proposal"]
end
end

Expand Down

0 comments on commit 6984076

Please sign in to comment.