Skip to content

Commit

Permalink
Unify YaST module mocking in unit tests
Browse files Browse the repository at this point in the history
- Related to bsc#1194784
- 4.4.2
  • Loading branch information
lslezak committed Jan 21, 2022
1 parent 91065cd commit af0a72d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
6 changes: 6 additions & 0 deletions package/yast2-firewall.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jan 21 07:37:21 UTC 2022 - Ladislav Slezák <lslezak@suse.cz>

- Unify YaST module mocking in unit tests (related to bsc#1194784)
- 4.4.2

-------------------------------------------------------------------
Wed Jun 16 12:33:45 UTC 2021 - José Iván López González <jlopez@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-firewall.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-firewall
Version: 4.4.1
Version: 4.4.2
Release: 0
Summary: YaST2 - Firewall Configuration
Group: System/YaST
Expand Down
15 changes: 3 additions & 12 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@ def require(path)
end
end

# stub module to prevent its Import
# Useful for modules from different yast packages, to avoid build dependencies
def stub_module(name, fake_class = nil)
fake_class = Class.new { def self.fake_method; end } if fake_class.nil?
Yast.const_set name.to_sym, fake_class
end

# stub classes from other modules to speed up a build
# rubocop:disable Style/SingleLineMethods
stub_module("AutoInstall", Class.new { def self.issues_list; []; end })
# rubocop:enable Style/SingleLineMethods

# some tests have translatable messages
ENV["LANG"] = "en_US.UTF-8"
ENV["LC_ALL"] = "en_US.UTF-8"
Expand Down Expand Up @@ -90,3 +78,6 @@ def stub_module(name, fake_class = nil)
]
end
end

# stub classes from other modules to avoid build dependencies
Yast::RSpec::Helpers.define_yast_module("AutoInstall", methods: [:issues_list])

0 comments on commit af0a72d

Please sign in to comment.