Skip to content

Commit

Permalink
Consider partially active as running
Browse files Browse the repository at this point in the history
Fix unit test
  • Loading branch information
teclator committed Mar 5, 2020
1 parent c2b7005 commit 25e0e86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/include/samba-server/complex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def WriteDialog
#
# @return [Boolean] true if the service is running; false otherwise
def need_to_restart?
SambaService.GetServiceRunning
# could be partialy active. i.e: smb is running and nmb is not
services.currently_active?
end

# Convenience method to check whether there are users connected to samba
Expand Down
3 changes: 2 additions & 1 deletion test/dialog_complex_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,18 @@ def initialize
allow(Yast2::SystemService).to receive(:find).with(anything).and_return(service)
allow(Yast2::CompoundService).to receive(:new).and_return(services)
allow(services).to receive(:action).and_return(action)
allow(services).to receive(:currently_active?).and_return(service_running)
end

let(:service) { instance_double("Yast2::SystemService", save: true, is_a?: true) }
let(:services) { instance_double("Yast2::CompoundService", save: true) }
let(:service_running) { false }
let(:action) { :start }

describe "#WriteDialog" do
subject(:samba) { TestComplexDialog.new }

let(:connected_users) { ["john", "jane"] }
let(:service_running) { false }
let(:service_on_boot) { false }

let(:auto) { false }
Expand Down

0 comments on commit 25e0e86

Please sign in to comment.