Skip to content

Commit

Permalink
Merge pull request #152 from yast/unify_module_mocks
Browse files Browse the repository at this point in the history
Unify YaST module mocking in unit tests
  • Loading branch information
lslezak committed Jan 21, 2022
2 parents 91065cd + af0a72d commit afb9aea
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
@@ -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
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
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 afb9aea

Please sign in to comment.