Skip to content

Commit

Permalink
Fix ConnectHelpers references
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Feb 14, 2017
1 parent aad0f6c commit 54016b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/lib/installation/update_repositories_finder.rb
Expand Up @@ -272,20 +272,20 @@ def display_fallback_warning
# Runs a block of code handling errors
#
# If errors should be shown, the helper {catch_registration_errors}
# from Registration::ConnectionHelpers will be used.
# from Registration::ConnectHelpers will be used.
#
# Otherwise, errors will be logged and the method will return +false+.
#
# @params [Boolean] True if errors should be shown to the user. False otherwise.
# @return [false, Object] The value returned by the block itself. False
# if the block failed.
#
# @see Registration::ConnectionHelpers.catch_registration_errors
# @see Registration::ConnectHelpers.catch_registration_errors
def handle_registration_errors(show_errors)
if show_errors
require "registration/connection_helpers"
require "registration/connect_helpers"
ret = nil
success = ::Registration::ConnectionHelpers.catch_registration_errors { ret = yield }
success = ::Registration::ConnectHelpers.catch_registration_errors { ret = yield }
success && ret
else
begin
Expand Down
10 changes: 5 additions & 5 deletions test/lib/update_repositories_finder_test.rb
Expand Up @@ -20,8 +20,8 @@

before do
stub_const("Yast::Profile", ay_profile)
stub_const("::Registration::ConnectionHelpers", FakeConnectionHelpers)
allow(finder).to receive(:require).with("registration/connection_helpers")
stub_const("::Registration::ConnectHelpers", FakeConnectHelpers)
allow(finder).to receive(:require).with("registration/connect_helpers")
allow(Yast::Linuxrc).to receive(:InstallInf).with("SelfUpdate")
.and_return(url_from_linuxrc)
end
Expand Down Expand Up @@ -148,7 +148,7 @@
end

it "handles registration errors" do
expect(Registration::ConnectionHelpers).to receive(:catch_registration_errors)
expect(Registration::ConnectHelpers).to receive(:catch_registration_errors)
.and_call_original
finder.updates
end
Expand Down Expand Up @@ -184,7 +184,7 @@
end

it "does not handles registration errors" do
expect(Registration::ConnectionHelpers).to_not receive(:catch_registration_errors)
expect(Registration::ConnectHelpers).to_not receive(:catch_registration_errors)
finder.updates
end
end
Expand All @@ -199,7 +199,7 @@
end

it "handles registration errors" do
expect(Registration::ConnectionHelpers).to receive(:catch_registration_errors)
expect(Registration::ConnectHelpers).to receive(:catch_registration_errors)
.and_call_original
finder.updates
end
Expand Down
2 changes: 1 addition & 1 deletion test/support/fake_registration.rb
Expand Up @@ -10,7 +10,7 @@ class FakeRegConfig
def import(_args); end
end

module FakeConnectionHelpers
module FakeConnectHelpers
def self.catch_registration_errors
yield
true
Expand Down

0 comments on commit 54016b8

Please sign in to comment.