-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #432 from yast/fix_execute
Fix execute
- Loading branch information
Showing
5 changed files
with
97 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env rspec | ||
|
||
require_relative "test_helper" | ||
require "yast2/execute" | ||
|
||
Yast.import "Report" | ||
|
||
describe Yast::Execute do | ||
it "sets yast logger as cheetah logger" do | ||
expect(Cheetah.default_options[:logger]).to eq Yast::Y2Logger.instance | ||
end | ||
|
||
describe ".locally" do | ||
it "passes arguments directly to cheetah" do | ||
expect(Cheetah).to receive(:run).with("ls", "-a") | ||
|
||
Yast::Execute.locally("ls", "-a") | ||
end | ||
|
||
it "report error if command execution failed" do | ||
expect(Yast::Report).to receive(:Error) | ||
Yast::Execute.locally("false") | ||
end | ||
|
||
it "returns nil if command execution failed" do | ||
expect(Yast::Execute.locally("false")).to eq nil | ||
end | ||
end | ||
|
||
describe ".on_target" do | ||
it "adds to passed arguments chroot option if scr chrooted" do | ||
Yast::Installation.destdir = "/mnt" | ||
allow(Yast::WFM).to receive(:scr_chrooted?).and_return(true) | ||
expect(Cheetah).to receive(:run).with("ls", "-a", chroot: "/mnt") | ||
|
||
Yast::Execute.on_target("ls", "-a") | ||
end | ||
|
||
it "report error if command execution failed" do | ||
expect(Yast::Report).to receive(:Error) | ||
Yast::Execute.on_target("false") | ||
end | ||
|
||
it "returns nil if command execution failed" do | ||
expect(Yast::Execute.on_target("false")).to eq nil | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
|
||
|
||
Name: yast2 | ||
Version: 3.1.171 | ||
Version: 3.1.172 | ||
Release: 0 | ||
Url: https://github.com/yast/yast-yast2 | ||
|
||
|