Skip to content

Commit

Permalink
Merge branch 'master' into unify-package-rb
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Jan 21, 2022
2 parents e329740 + 6d7700d commit d411bac
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 24 deletions.
13 changes: 12 additions & 1 deletion library/cwm/src/lib/cwm/dialog.rb
Expand Up @@ -31,7 +31,18 @@ def initialize(*args, **kws); end

# A shortcut for `.new(*args).run`
def self.run(*args, **kws)
new(*args, **kws).run
# Argument delegation is handled differently since ruby 2.7:
#
# An empty Hash argument is automatically converted and absorbed into **kws, and the delegation
# call removes the empty keyword hash, so no argument is passed to target. In ruby 2.6 and before,
# an empty hash is passed:
#
# * Ruby 2.6 or before: run("foo") passes new("foo", {})
# * Ruby 2.7 or later: run("foo") passes new("foo")
#
# See https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
dialog = kws.empty? ? new(*args) : new(*args, **kws)
dialog.run
end

# The entry point.
Expand Down
8 changes: 7 additions & 1 deletion library/cwm/test/dialog_test.rb
Expand Up @@ -32,12 +32,18 @@ def contents
allow(Yast::CWM).to receive(:show).and_return(:next)
end

it "pass all arguments to constructor" do
it "pass all given arguments to constructor" do
expect(TestCWMDialog).to receive(:new).with("test2", disable: :next).and_call_original

TestCWMDialog.run("test2", disable: :next)
end

it "does not past extra arguments to constructor" do
expect(TestCWMDialog).to receive(:new).with(no_args).and_call_original

TestCWMDialog.run
end

it "opens a dialog when needed, and calls CWM#show" do
expect(Yast::Wizard).to receive(:IsWizardDialog).and_return(false)
expect(Yast::Wizard).to receive(:CreateDialog)
Expand Down
11 changes: 9 additions & 2 deletions package/yast2.changes
@@ -1,11 +1,18 @@
-------------------------------------------------------------------
Wed Jan 19 11:46:14 UTC 2022 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>
Fri Jan 21 15:41:19 UTC 2022 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Unify Package, PackageSystem and PackageAI. Now the Package
module is the entry point. PackageSystem and PackageAI implement
specific logic and they should not be referenced from outside
(bsc#1194886).
- 4.3.37
- 4.3.38

-------------------------------------------------------------------
Fri Jan 21 12:51:45 UTC 2022 - José Iván López González <jlopez@suse.com>

- Fix CWM dialog: argument delegation is handled differently in
ruby 2.6 and before (bsc#1194984).
- 4.4.37

-------------------------------------------------------------------
Fri Jan 14 13:56:49 UTC 2022 - Ancor Gonzalez Sosa <ancor@suse.com>
Expand Down
6 changes: 3 additions & 3 deletions package/yast2.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2
Version: 4.4.37
Version: 4.4.38

Release: 0
Summary: YaST2 Main Package
Expand Down Expand Up @@ -54,8 +54,8 @@ BuildRequires: yast2-pkg-bindings >= 4.3.7
BuildRequires: rubygem(%rb_default_ruby_abi:yast-rake)
# for XML module
BuildRequires: rubygem(%rb_default_ruby_abi:nokogiri)
# To have Yast::WFM.scr_root
BuildRequires: yast2-ruby-bindings >= 3.2.8
# yast/rspec/helpers.rb
BuildRequires: yast2-ruby-bindings >= 4.4.7
BuildRequires: yast2-testsuite
# Nested items in tables
BuildRequires: yast2-ycp-ui-bindings >= 4.3.3
Expand Down
18 changes: 1 addition & 17 deletions test/test_helper.rb
Expand Up @@ -59,20 +59,4 @@
end

# mock missing YaST modules
begin
# try loading the Yast::InstURL module, we cannot depend on it (because of
# circular build dependency), but it is present when running the tests
# locally or in GitHub Actions
Yast.import "InstURL"
rescue NameError
# if it is missing then mock it
module Yast
class InstURLClass
def installInf2Url(_extra_dir = "")
""
end
end

InstURL = InstURLClass.new
end
end
Yast::RSpec::Helpers.define_yast_module("InstURL", methods: [:installInf2Url])

0 comments on commit d411bac

Please sign in to comment.