linux_admin 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/linux_admin/common.rb +4 -4
  3. data/lib/linux_admin/deb.rb +1 -1
  4. data/lib/linux_admin/disk.rb +6 -8
  5. data/lib/linux_admin/hosts.rb +4 -6
  6. data/lib/linux_admin/ip_address.rb +4 -6
  7. data/lib/linux_admin/logical_volume.rb +3 -3
  8. data/lib/linux_admin/mountable.rb +5 -8
  9. data/lib/linux_admin/network_interface.rb +4 -6
  10. data/lib/linux_admin/package.rb +0 -1
  11. data/lib/linux_admin/physical_volume.rb +3 -6
  12. data/lib/linux_admin/registration_system/rhn.rb +5 -5
  13. data/lib/linux_admin/registration_system/subscription_manager.rb +2 -2
  14. data/lib/linux_admin/registration_system.rb +1 -2
  15. data/lib/linux_admin/rpm.rb +7 -5
  16. data/lib/linux_admin/service/sys_v_init_service.rb +12 -12
  17. data/lib/linux_admin/service/systemd_service.rb +12 -12
  18. data/lib/linux_admin/service.rb +1 -3
  19. data/lib/linux_admin/system.rb +2 -4
  20. data/lib/linux_admin/time_date.rb +3 -4
  21. data/lib/linux_admin/version.rb +1 -1
  22. data/lib/linux_admin/volume.rb +1 -1
  23. data/lib/linux_admin/volume_group.rb +7 -10
  24. data/lib/linux_admin/yum.rb +6 -8
  25. data/lib/linux_admin.rb +0 -2
  26. data/spec/common_spec.rb +6 -8
  27. data/spec/deb_spec.rb +3 -3
  28. data/spec/disk_spec.rb +27 -27
  29. data/spec/hosts_spec.rb +5 -5
  30. data/spec/ip_address_spec.rb +4 -4
  31. data/spec/logical_volume_spec.rb +38 -38
  32. data/spec/mountable_spec.rb +22 -20
  33. data/spec/network_interface/network_interface_rh_spec.rb +13 -9
  34. data/spec/network_interface_spec.rb +4 -6
  35. data/spec/partition_spec.rb +1 -1
  36. data/spec/physical_volume_spec.rb +16 -20
  37. data/spec/rhn_spec.rb +22 -9
  38. data/spec/rpm_spec.rb +6 -4
  39. data/spec/service/sys_v_init_service_spec.rb +27 -28
  40. data/spec/service/systemd_service_spec.rb +20 -20
  41. data/spec/service_spec.rb +1 -1
  42. data/spec/subscription_manager_spec.rb +27 -15
  43. data/spec/system_spec.rb +2 -6
  44. data/spec/time_date_spec.rb +1 -1
  45. data/spec/volume_group_spec.rb +15 -19
  46. data/spec/yum_spec.rb +27 -15
  47. metadata +8 -6
data/spec/hosts_spec.rb CHANGED
@@ -81,20 +81,20 @@ describe LinuxAdmin::Hosts do
81
81
  describe "#hostname=" do
82
82
  it "sets the hostname using hostnamectl when the command exists" do
83
83
  spawn_args = [
84
- @instance.cmd('hostnamectl'),
84
+ LinuxAdmin::Common.cmd('hostnamectl'),
85
85
  :params => ['set-hostname', TEST_HOSTNAME]
86
86
  ]
87
- expect(@instance).to receive(:cmd?).with("hostnamectl").and_return(true)
87
+ expect(LinuxAdmin::Common).to receive(:cmd?).with("hostnamectl").and_return(true)
88
88
  expect(AwesomeSpawn).to receive(:run!).with(*spawn_args)
89
89
  @instance.hostname = TEST_HOSTNAME
90
90
  end
91
91
 
92
92
  it "sets the hostname with hostname when hostnamectl does not exist" do
93
93
  spawn_args = [
94
- @instance.cmd('hostname'),
94
+ LinuxAdmin::Common.cmd('hostname'),
95
95
  :params => {:file => "/etc/hostname"}
96
96
  ]
97
- expect(@instance).to receive(:cmd?).with("hostnamectl").and_return(false)
97
+ expect(LinuxAdmin::Common).to receive(:cmd?).with("hostnamectl").and_return(false)
98
98
  expect(File).to receive(:write).with("/etc/hostname", TEST_HOSTNAME)
99
99
  expect(AwesomeSpawn).to receive(:run!).with(*spawn_args)
100
100
  @instance.hostname = TEST_HOSTNAME
@@ -103,7 +103,7 @@ describe LinuxAdmin::Hosts do
103
103
 
104
104
  describe "#hostname" do
105
105
  let(:spawn_args) do
106
- [@instance.cmd('hostname'), {}]
106
+ [LinuxAdmin::Common.cmd('hostname'), {}]
107
107
  end
108
108
 
109
109
  it "returns the hostname" do
@@ -2,22 +2,22 @@ describe LinuxAdmin::IpAddress do
2
2
  let(:ip) { described_class.new }
3
3
 
4
4
  ADDR_SPAWN_ARGS = [
5
- described_class.new.cmd("hostname"),
5
+ LinuxAdmin::Common.cmd("hostname"),
6
6
  :params => ["-I"]
7
7
  ]
8
8
 
9
9
  MAC_SPAWN_ARGS = [
10
- described_class.new.cmd("ip"),
10
+ LinuxAdmin::Common.cmd("ip"),
11
11
  :params => %w(addr show eth0)
12
12
  ]
13
13
 
14
14
  MASK_SPAWN_ARGS = [
15
- described_class.new.cmd("ifconfig"),
15
+ LinuxAdmin::Common.cmd("ifconfig"),
16
16
  :params => %w(eth0)
17
17
  ]
18
18
 
19
19
  GW_SPAWN_ARGS = [
20
- described_class.new.cmd("ip"),
20
+ LinuxAdmin::Common.cmd("ip"),
21
21
  :params => %w(route)
22
22
  ]
23
23
 
@@ -21,16 +21,16 @@ eos
21
21
  it "uses lvextend" do
22
22
  vg = LinuxAdmin::VolumeGroup.new :name => 'vg'
23
23
  lv = described_class.new :name => 'lv', :volume_group => vg
24
- expect(lv).to receive(:run!).
25
- with(vg.cmd(:lvextend),
26
- :params => ['lv', 'vg'])
24
+ expect(LinuxAdmin::Common).to receive(:run!)
25
+ .with(LinuxAdmin::Common.cmd(:lvextend),
26
+ :params => %w(lv vg))
27
27
  lv.extend_with(vg)
28
28
  end
29
29
 
30
30
  it "returns self" do
31
31
  vg = LinuxAdmin::VolumeGroup.new :name => 'vg'
32
32
  lv = described_class.new :name => 'lv', :volume_group => vg
33
- allow(lv).to receive(:run!)
33
+ allow(LinuxAdmin::Common).to receive(:run!)
34
34
  expect(lv.extend_with(vg)).to eq(lv)
35
35
  end
36
36
  end
@@ -50,22 +50,22 @@ eos
50
50
 
51
51
  it "uses lvcreate" do
52
52
  described_class.instance_variable_set(:@lvs, [])
53
- expect(described_class).to receive(:run!).
54
- with(LinuxAdmin.cmd(:lvcreate),
55
- :params => { '-n' => 'lv',
56
- nil => 'vg',
57
- '-L' => '256G' })
53
+ expect(LinuxAdmin::Common).to receive(:run!)
54
+ .with(LinuxAdmin::Common.cmd(:lvcreate),
55
+ :params => {'-n' => 'lv',
56
+ nil => 'vg',
57
+ '-L' => '256G'})
58
58
  described_class.create 'lv', @vg, 256.gigabytes
59
59
  end
60
60
 
61
61
  context "size is specified" do
62
62
  it "passes -L option to lvcreate" do
63
63
  described_class.instance_variable_set(:@lvs, [])
64
- expect(described_class).to receive(:run!).
65
- with(LinuxAdmin.cmd(:lvcreate),
66
- :params => { '-n' => 'lv',
67
- nil => 'vg',
68
- '-L' => '256G' })
64
+ expect(LinuxAdmin::Common).to receive(:run!)
65
+ .with(LinuxAdmin::Common.cmd(:lvcreate),
66
+ :params => {'-n' => 'lv',
67
+ nil => 'vg',
68
+ '-L' => '256G'})
69
69
  described_class.create 'lv', @vg, 256.gigabytes
70
70
  end
71
71
  end
@@ -73,18 +73,18 @@ eos
73
73
  context "extents is specified" do
74
74
  it "passes -l option to lvcreate" do
75
75
  described_class.instance_variable_set(:@lvs, [])
76
- expect(described_class).to receive(:run!).
77
- with(LinuxAdmin.cmd(:lvcreate),
78
- :params => { '-n' => 'lv',
79
- nil => 'vg',
80
- '-l' => '100%FREE' })
76
+ expect(LinuxAdmin::Common).to receive(:run!)
77
+ .with(LinuxAdmin::Common.cmd(:lvcreate),
78
+ :params => {'-n' => 'lv',
79
+ nil => 'vg',
80
+ '-l' => '100%FREE'})
81
81
  described_class.create 'lv', @vg, 100
82
82
  end
83
83
  end
84
84
 
85
85
  it "returns new logical volume" do
86
- allow(LinuxAdmin::VolumeGroup).to receive_messages(:run! => double(:output => ""))
87
- allow(described_class).to receive_messages(:run! => double(:output => ""))
86
+ allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
87
+ allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
88
88
  lv = described_class.create 'lv', @vg, 256.gigabytes
89
89
  expect(lv).to be_an_instance_of(described_class)
90
90
  expect(lv.name).to eq('lv')
@@ -92,8 +92,8 @@ eos
92
92
 
93
93
  context "name is specified" do
94
94
  it "sets path under volume group" do
95
- allow(LinuxAdmin::VolumeGroup).to receive_messages(:run! => double(:output => ""))
96
- allow(described_class).to receive_messages(:run! => double(:output => ""))
95
+ allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
96
+ allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
97
97
  lv = described_class.create 'lv', @vg, 256.gigabytes
98
98
  expect(lv.path.to_s).to eq("#{described_class::DEVICE_PATH}#{@vg.name}/lv")
99
99
  end
@@ -101,8 +101,8 @@ eos
101
101
 
102
102
  context "path is specified" do
103
103
  it "sets name" do
104
- allow(LinuxAdmin::VolumeGroup).to receive_messages(:run! => double(:output => ""))
105
- allow(described_class).to receive_messages(:run! => double(:output => ""))
104
+ allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
105
+ allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
106
106
  lv = described_class.create '/dev/lv', @vg, 256.gigabytes
107
107
  expect(lv.name).to eq("lv")
108
108
  end
@@ -111,8 +111,8 @@ eos
111
111
  context "path is specified as Pathname" do
112
112
  it "sets name" do
113
113
  require 'pathname'
114
- allow(LinuxAdmin::VolumeGroup).to receive_messages(:run! => double(:output => ""))
115
- allow(described_class).to receive_messages(:run! => double(:output => ""))
114
+ allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
115
+ allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
116
116
  lv = described_class.create Pathname.new("/dev/#{@vg.name}/lv"), @vg, 256.gigabytes
117
117
  expect(lv.name).to eq("lv")
118
118
  expect(lv.path).to eq("/dev/vg/lv")
@@ -120,8 +120,8 @@ eos
120
120
  end
121
121
 
122
122
  it "adds logical volume to local registry" do
123
- allow(LinuxAdmin::VolumeGroup).to receive_messages(:run! => double(:output => ""))
124
- allow(described_class).to receive_messages(:run! => double(:output => ""))
123
+ allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
124
+ allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
125
125
  lv = described_class.create 'lv', @vg, 256.gigabytes
126
126
  expect(described_class.scan).to include(lv)
127
127
  end
@@ -129,17 +129,17 @@ eos
129
129
 
130
130
  describe "#scan" do
131
131
  it "uses lvdisplay" do
132
- expect(described_class).to receive(:run!).
133
- with(LinuxAdmin.cmd(:lvdisplay),
134
- :params => { '-c' => nil}).
135
- and_return(double(:output => @logical_volumes))
136
- expect(LinuxAdmin::VolumeGroup).to receive(:run!).and_return(double(:output => @groups)) # stub out call to vgdisplay
132
+ expect(LinuxAdmin::Common).to receive(:run!)
133
+ .with(LinuxAdmin::Common.cmd(:lvdisplay),
134
+ :params => {'-c' => nil})
135
+ .and_return(double(:output => @logical_volumes))
136
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @groups)) # stub out call to vgdisplay
137
137
  described_class.scan
138
138
  end
139
139
 
140
140
  it "returns local logical volumes" do
141
- expect(described_class).to receive(:run!).and_return(double(:output => @logical_volumes))
142
- expect(LinuxAdmin::VolumeGroup).to receive(:run!).and_return(double(:output => @groups))
141
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @logical_volumes))
142
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @groups))
143
143
  lvs = described_class.scan
144
144
 
145
145
  expect(lvs[0]).to be_an_instance_of(described_class)
@@ -154,8 +154,8 @@ eos
154
154
  end
155
155
 
156
156
  it "resolves volume group references" do
157
- expect(described_class).to receive(:run!).and_return(double(:output => @logical_volumes))
158
- expect(LinuxAdmin::VolumeGroup).to receive(:run!).and_return(double(:output => @groups))
157
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @logical_volumes))
158
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @groups))
159
159
  lvs = described_class.scan
160
160
  expect(lvs[0].volume_group).to be_an_instance_of(LinuxAdmin::VolumeGroup)
161
161
  expect(lvs[0].volume_group.name).to eq('vg_foobar')
@@ -12,7 +12,7 @@ describe LinuxAdmin::Mountable do
12
12
 
13
13
  # stub out calls that modify system
14
14
  allow(FileUtils).to receive(:mkdir)
15
- allow(@mountable).to receive(:run!)
15
+ allow(LinuxAdmin::Common).to receive(:run!)
16
16
 
17
17
  @mount_out1 = <<eos
18
18
  /dev/sda on /mnt/usb type vfat (rw)
@@ -25,20 +25,21 @@ eos
25
25
 
26
26
  describe "#mount_point_exists?" do
27
27
  it "uses mount" do
28
- expect(TestMountable).to receive(:run!).with(TestMountable.cmd(:mount)).and_return(double(:output => ""))
28
+ expect(LinuxAdmin::Common).to receive(:run!).with(LinuxAdmin::Common.cmd(:mount))
29
+ .and_return(double(:output => ""))
29
30
  TestMountable.mount_point_exists?('/mnt/usb')
30
31
  end
31
32
 
32
33
  context "disk mounted at specified location" do
33
34
  it "returns true" do
34
- expect(TestMountable).to receive(:run!).and_return(double(:output => @mount_out1))
35
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out1))
35
36
  expect(TestMountable.mount_point_exists?('/mnt/usb')).to be_truthy
36
37
  end
37
38
  end
38
39
 
39
40
  context "no disk mounted at specified location" do
40
41
  it "returns false" do
41
- expect(TestMountable).to receive(:run!).and_return(double(:output => @mount_out2))
42
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out2))
42
43
  expect(TestMountable.mount_point_exists?('/mnt/usb')).to be_falsey
43
44
  end
44
45
  end
@@ -46,20 +47,21 @@ eos
46
47
 
47
48
  describe "#mount_point_available?" do
48
49
  it "uses mount" do
49
- expect(TestMountable).to receive(:run!).with(TestMountable.cmd(:mount)).and_return(double(:output => ""))
50
+ expect(LinuxAdmin::Common).to receive(:run!).with(LinuxAdmin::Common.cmd(:mount))
51
+ .and_return(double(:output => ""))
50
52
  TestMountable.mount_point_available?('/mnt/usb')
51
53
  end
52
54
 
53
55
  context "disk mounted at specified location" do
54
56
  it "returns false" do
55
- expect(TestMountable).to receive(:run!).and_return(double(:output => @mount_out1))
57
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out1))
56
58
  expect(TestMountable.mount_point_available?('/mnt/usb')).to be_falsey
57
59
  end
58
60
  end
59
61
 
60
62
  context "no disk mounted at specified location" do
61
63
  it "returns true" do
62
- expect(TestMountable).to receive(:run!).and_return(double(:output => @mount_out2))
64
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out2))
63
65
  expect(TestMountable.mount_point_available?('/mnt/usb')).to be_truthy
64
66
  end
65
67
  end
@@ -67,14 +69,14 @@ eos
67
69
 
68
70
  describe "#format_to" do
69
71
  it "uses mke2fs" do
70
- expect(@mountable).to receive(:run!).
71
- with(@mountable.cmd(:mke2fs),
72
- :params => { '-t' => 'ext4', nil => '/dev/foo'})
72
+ expect(LinuxAdmin::Common).to receive(:run!)
73
+ .with(LinuxAdmin::Common.cmd(:mke2fs),
74
+ :params => {'-t' => 'ext4', nil => '/dev/foo'})
73
75
  @mountable.format_to('ext4')
74
76
  end
75
77
 
76
78
  it "sets fs type" do
77
- expect(@mountable).to receive(:run!) # ignore actual formatting cmd
79
+ expect(LinuxAdmin::Common).to receive(:run!) # ignore actual formatting cmd
78
80
  @mountable.format_to('ext4')
79
81
  expect(@mountable.fs_type).to eq('ext4')
80
82
  end
@@ -83,19 +85,19 @@ eos
83
85
  describe "#mount" do
84
86
  it "sets mount point" do
85
87
  # ignore actual mount cmds
86
- expect(@mountable).to receive(:run!).and_return(double(:output => ""))
87
- expect(TestMountable).to receive(:run!).and_return(double(:output => ""))
88
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => ""))
89
+ expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => ""))
88
90
 
89
91
  expect(@mountable.mount('/mnt/sda2')).to eq('/mnt/sda2')
90
92
  expect(@mountable.mount_point).to eq('/mnt/sda2')
91
93
  end
92
-
94
+
93
95
  context "mountpoint does not exist" do
94
96
  it "creates mountpoint" do
95
97
  expect(TestMountable).to receive(:mount_point_exists?).and_return(false)
96
98
  expect(File).to receive(:directory?).with('/mnt/sda2').and_return(false)
97
99
  expect(FileUtils).to receive(:mkdir).with('/mnt/sda2')
98
- expect(@mountable).to receive(:run!) # ignore actual mount cmd
100
+ expect(LinuxAdmin::Common).to receive(:run!) # ignore actual mount cmd
99
101
  @mountable.mount '/mnt/sda2'
100
102
  end
101
103
  end
@@ -110,9 +112,9 @@ eos
110
112
 
111
113
  it "mounts partition" do
112
114
  expect(TestMountable).to receive(:mount_point_exists?).and_return(false)
113
- expect(@mountable).to receive(:run!).
114
- with(@mountable.cmd(:mount),
115
- :params => { nil => ['/dev/foo', '/mnt/sda2']})
115
+ expect(LinuxAdmin::Common).to receive(:run!)
116
+ .with(LinuxAdmin::Common.cmd(:mount),
117
+ :params => {nil => ['/dev/foo', '/mnt/sda2']})
116
118
  @mountable.mount '/mnt/sda2'
117
119
  end
118
120
  end
@@ -120,9 +122,9 @@ eos
120
122
  describe "#umount" do
121
123
  it "unmounts partition" do
122
124
  @mountable.mount_point = '/mnt/sda2'
123
- expect(@mountable).to receive(:run!).with(@mountable.cmd(:umount), :params => { nil => ['/mnt/sda2']})
125
+ expect(LinuxAdmin::Common).to receive(:run!).with(LinuxAdmin::Common.cmd(:umount),
126
+ :params => {nil => ['/mnt/sda2']})
124
127
  @mountable.umount
125
128
  end
126
129
  end
127
-
128
130
  end
@@ -1,6 +1,7 @@
1
1
  describe LinuxAdmin::NetworkInterfaceRH do
2
- DEVICE_NAME = "eth0"
3
- IFCFG_FILE_DHCP = <<-EOF
2
+ let(:device_name) { "eth0" }
3
+ let(:ifcfg_file_dhcp) do
4
+ <<-EOF
4
5
  #A comment is here
5
6
  DEVICE=eth0
6
7
  BOOTPROTO=dhcp
@@ -9,8 +10,10 @@ ONBOOT=yes
9
10
  TYPE=Ethernet
10
11
  NAME="System eth0"
11
12
  EOF
13
+ end
12
14
 
13
- IFCFG_FILE_STATIC = <<-EOF
15
+ let(:ifcfg_file_static) do
16
+ <<-EOF
14
17
  #A comment is here
15
18
  DEVICE=eth0
16
19
  BOOTPROTO=static
@@ -22,6 +25,7 @@ IPADDR=192.168.1.100
22
25
  NETMASK=255.255.255.0
23
26
  GATEWAY=192.168.1.1
24
27
  EOF
28
+ end
25
29
 
26
30
  def stub_foreach_to_string(string)
27
31
  allow(File).to receive(:foreach) do |&block|
@@ -35,16 +39,16 @@ EOF
35
39
 
36
40
  subject(:dhcp_interface) do
37
41
  allow(File).to receive(:exist?).and_return(true)
38
- stub_foreach_to_string(IFCFG_FILE_DHCP)
42
+ stub_foreach_to_string(ifcfg_file_dhcp)
39
43
  allow(AwesomeSpawn).to receive(:run!).twice.and_return(result("", 0))
40
- described_class.new(DEVICE_NAME)
44
+ described_class.new(device_name)
41
45
  end
42
46
 
43
47
  subject(:static_interface) do
44
48
  allow(File).to receive(:exist?).and_return(true)
45
- stub_foreach_to_string(IFCFG_FILE_STATIC)
49
+ stub_foreach_to_string(ifcfg_file_static)
46
50
  allow(AwesomeSpawn).to receive(:run!).twice.and_return(result("", 0))
47
- described_class.new(DEVICE_NAME)
51
+ described_class.new(device_name)
48
52
  end
49
53
 
50
54
  describe ".new" do
@@ -63,7 +67,7 @@ EOF
63
67
  describe "#parse_conf" do
64
68
  it "reloads the interface configuration" do
65
69
  interface = dhcp_interface
66
- stub_foreach_to_string(IFCFG_FILE_STATIC)
70
+ stub_foreach_to_string(ifcfg_file_static)
67
71
  interface.parse_conf
68
72
 
69
73
  conf = interface.interface_config
@@ -198,7 +202,7 @@ EOF
198
202
  end
199
203
 
200
204
  describe "#save" do
201
- let(:iface_file) { Pathname.new("/etc/sysconfig/network-scripts/ifcfg-#{DEVICE_NAME}") }
205
+ let(:iface_file) { Pathname.new("/etc/sysconfig/network-scripts/ifcfg-#{device_name}") }
202
206
 
203
207
  def expect_old_contents
204
208
  expect(File).to receive(:write) do |file, contents|
@@ -58,25 +58,23 @@ describe LinuxAdmin::NetworkInterface do
58
58
  end
59
59
 
60
60
  context "on all systems" do
61
- common_inst = Class.new { include LinuxAdmin::Common }.new
62
-
63
61
  IP_SHOW_ARGS = [
64
- common_inst.cmd("ip"),
62
+ LinuxAdmin::Common.cmd("ip"),
65
63
  :params => %w(addr show eth0)
66
64
  ]
67
65
 
68
66
  IP_ROUTE_ARGS = [
69
- common_inst.cmd("ip"),
67
+ LinuxAdmin::Common.cmd("ip"),
70
68
  :params => %w(route)
71
69
  ]
72
70
 
73
71
  IFUP_ARGS = [
74
- common_inst.cmd("ifup"),
72
+ LinuxAdmin::Common.cmd("ifup"),
75
73
  :params => ["eth0"]
76
74
  ]
77
75
 
78
76
  IFDOWN_ARGS = [
79
- common_inst.cmd("ifdown"),
77
+ LinuxAdmin::Common.cmd("ifdown"),
80
78
  :params => ["eth0"]
81
79
  ]
82
80
 
@@ -15,7 +15,7 @@ describe LinuxAdmin::Partition do
15
15
  it "sets default mount_point" do
16
16
  expect(described_class).to receive(:mount_point_exists?).and_return(false)
17
17
  expect(File).to receive(:directory?).with('/mnt/sda2').and_return(true)
18
- expect(@partition).to receive(:run!)
18
+ expect(LinuxAdmin::Common).to receive(:run!)
19
19
  @partition.mount
20
20
  expect(@partition.mount_point).to eq('/mnt/sda2')
21
21
  end