-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for RemoveHomeContentAction
- Loading branch information
1 parent
23e893b
commit e57a89d
Showing
2 changed files
with
42 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require_relative "../test_helper" | ||
|
||
require "date" | ||
require "y2users/user" | ||
require "y2users/linux/remove_home_content_action" | ||
require "y2users/commit_config" | ||
|
||
describe Y2Users::Linux::RemoveHomeContentAction do | ||
subject(:action) { described_class.new(user, commit_config) } | ||
let(:user) { Y2Users::User.new("test") } | ||
let(:commit_config) { nil } | ||
|
||
before do | ||
allow(Yast::Execute).to receive(:on_target!) | ||
end | ||
|
||
describe "#perform" do | ||
|
||
it "removes content with find -mindepth 1 -delete" do | ||
expect(Yast::Execute).to receive(:on_target!) do |cmd, *args| | ||
expect(cmd).to eq "/usr/bin/find" | ||
expect(args).to include "-mindepth" | ||
expect(args).to include "1" | ||
expect(args).to include "-delete" | ||
end | ||
|
||
action.perform | ||
end | ||
|
||
it "passes user home as parameter" do | ||
user.home.path = "/tmp/home" | ||
|
||
expect(Yast::Execute).to receive(:on_target!) do |_cmd, *args| | ||
expect(args).to include "/tmp/home" | ||
end | ||
|
||
action.perform | ||
end | ||
end | ||
end |