Skip to content

Commit

Permalink
Improve mocking Yast::InstURL module
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Dec 16, 2021
1 parent 83b4526 commit 8678fa6
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions test/test_helper.rb
Expand Up @@ -59,13 +59,20 @@
end

# mock missing YaST modules
module Yast
# we cannot depend on this module (circular dependency)
class InstURLClass
def installInf2Url(_extra_dir = "")
""
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
end

InstURL = InstURLClass.new
InstURL = InstURLClass.new
end
end

0 comments on commit 8678fa6

Please sign in to comment.