forked from yast/yast-installation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdesktop_finish_test.rb
68 lines (54 loc) · 1.83 KB
/
desktop_finish_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require_relative "test_helper"
require "installation/clients/desktop_finish"
describe Yast::DesktopFinishClient do
describe "#title" do
it "returns translated string" do
expect(subject.title).to be_a(::String)
end
end
describe "#modes" do
it "runs in installation" do
expect(subject.modes).to include(:installation)
end
it "runs in autoinstallation" do
expect(subject.modes).to include(:autoinst)
end
it "does not run in update" do
expect(subject.modes).to_not include(:update)
end
end
describe "#write" do
before do
allow(Yast::DefaultDesktop).to receive(:Desktop).and_return("gnome")
allow(Yast::DefaultDesktop).to receive(:GetAllDesktopsMap)
.and_return("gnome" => {
"logon" => "gdm",
"cursor" => "DMZ",
"desktop" => "gnome"
})
allow(Yast::SCR).to receive(:Write)
allow(Yast::Execute).to receive(:on_target)
end
it "do nothing if no desktop is selected" do
allow(Yast::DefaultDesktop).to receive(:Desktop).and_return(nil)
expect(Yast::SCR).to_not receive(:Write)
expect(Yast::Execute).to_not receive(:on_target)
subject.write
end
it "writes default wm for selected desktop" do
expect(Yast::SCR).to receive(:Write)
.with(path(".sysconfig.windowmanager.DEFAULT_WM"), "gnome")
subject.write
end
it "writes cursor for selected desktop" do
expect(Yast::SCR).to receive(:Write)
.with(path(".sysconfig.windowmanager.X_MOUSE_CURSOR"), "DMZ")
subject.write
end
it "does not write the displaymanager (bsc#1125040)" do
expect(Yast::SCR).to_not receive(:Write)
.with(path(".sysconfig.displaymanager.DISPLAYMANAGER"), anything)
subject.write
end
end
end