Last active
August 29, 2015 14:00
-
-
Save vmoravec/11394484 to your computer and use it in GitHub Desktop.
Test for stop and restart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context "Restart a service on the installation system" do | |
it "restarts a service with a specialized inst-sys helper if available" do | |
File.stub(:exist?).with('/bin/service_start').and_return(true) | |
service = SystemdService.find("sshd") | |
SCR.stub(:Execute).and_return({'stderr'=>'', 'stdout'=>'', 'exit'=>0}) | |
expect(service).not_to receive(:command) # SystemdUnit#command | |
expect(service).to receive(:stop) | |
expect(service).to recieve(:start) | |
expect(service.restart).to be_true | |
end | |
it "stops a service with a specialized inst-sys helper" do | |
File.stub(:exist?).with('/bin/service_start').and_return(true) | |
service = SystemdService.find("sshd") | |
SCR.stub(:Execute).and_return({'stderr'=>'', 'stdout'=>'', 'exit'=>0}) | |
expect(service).not_to receive(:command) # SystemdUnit#command | |
expect(service.stop).to be_true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment