linux_admin 0.9.1 → 0.9.2

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.
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe LinuxAdmin::Partition do
4
2
  before(:each) do
5
3
  @disk = LinuxAdmin::Disk.new :path => '/dev/sda'
@@ -8,18 +6,18 @@ describe LinuxAdmin::Partition do
8
6
 
9
7
  describe "#path" do
10
8
  it "returns partition path" do
11
- @partition.path.should == '/dev/sda2'
9
+ expect(@partition.path).to eq('/dev/sda2')
12
10
  end
13
11
  end
14
12
 
15
13
  describe "#mount" do
16
14
  context "mount_point not specified" do
17
15
  it "sets default mount_point" do
18
- described_class.should_receive(:mount_point_exists?).and_return(false)
19
- File.should_receive(:directory?).with('/mnt/sda2').and_return(true)
20
- @partition.should_receive(:run!)
16
+ expect(described_class).to receive(:mount_point_exists?).and_return(false)
17
+ expect(File).to receive(:directory?).with('/mnt/sda2').and_return(true)
18
+ expect(@partition).to receive(:run!)
21
19
  @partition.mount
22
- @partition.mount_point.should == '/mnt/sda2'
20
+ expect(@partition.mount_point).to eq('/mnt/sda2')
23
21
  end
24
22
  end
25
23
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe LinuxAdmin::PhysicalVolume do
4
2
  before(:each) do
5
3
  @physical_volumes = <<eos
@@ -22,7 +20,7 @@ eos
22
20
  it "uses vgextend" do
23
21
  vg = LinuxAdmin::VolumeGroup.new :name => 'vg'
24
22
  pv = described_class.new :device_name => '/dev/hda'
25
- pv.should_receive(:run!).
23
+ expect(pv).to receive(:run!).
26
24
  with(pv.cmd(:vgextend),
27
25
  :params => ['vg', '/dev/hda'])
28
26
  pv.attach_to(vg)
@@ -31,77 +29,77 @@ eos
31
29
  it "assigns volume group to physical volume" do
32
30
  vg = LinuxAdmin::VolumeGroup.new :name => 'vg'
33
31
  pv = described_class.new :device_name => '/dev/hda'
34
- pv.stub(:run!)
32
+ allow(pv).to receive(:run!)
35
33
  pv.attach_to(vg)
36
- pv.volume_group.should == vg
34
+ expect(pv.volume_group).to eq(vg)
37
35
  end
38
36
 
39
37
  it "returns self" do
40
38
  vg = LinuxAdmin::VolumeGroup.new :name => 'vg'
41
39
  pv = described_class.new :device_name => '/dev/hda'
42
- pv.stub(:run!)
43
- pv.attach_to(vg).should == pv
40
+ allow(pv).to receive(:run!)
41
+ expect(pv.attach_to(vg)).to eq(pv)
44
42
  end
45
43
  end
46
44
 
47
45
  describe "#create" do
48
46
  before do
49
47
  @disk = LinuxAdmin::Disk.new :path => '/dev/hda'
50
- @disk.stub(:size)
48
+ allow(@disk).to receive(:size)
51
49
  end
52
50
 
53
51
  let(:disk) {@disk}
54
52
 
55
53
  it "uses pvcreate" do
56
54
  described_class.instance_variable_set(:@pvs, [])
57
- described_class.should_receive(:run!).
55
+ expect(described_class).to receive(:run!).
58
56
  with(LinuxAdmin.cmd(:pvcreate),
59
57
  :params => { nil => '/dev/hda'})
60
58
  described_class.create disk
61
59
  end
62
60
 
63
61
  it "returns new physical volume" do
64
- LinuxAdmin::VolumeGroup.stub(:run! => double(:output => ""))
65
- described_class.stub(:run! => double(:output => ""))
62
+ allow(LinuxAdmin::VolumeGroup).to receive_messages(:run! => double(:output => ""))
63
+ allow(described_class).to receive_messages(:run! => double(:output => ""))
66
64
  pv = described_class.create disk
67
- pv.should be_an_instance_of(described_class)
68
- pv.device_name.should == '/dev/hda'
65
+ expect(pv).to be_an_instance_of(described_class)
66
+ expect(pv.device_name).to eq('/dev/hda')
69
67
  end
70
68
 
71
69
  it "adds physical volume to local registry" do
72
- LinuxAdmin::VolumeGroup.stub(:run! => double(:output => ""))
73
- described_class.stub(:run! => double(:output => ""))
70
+ allow(LinuxAdmin::VolumeGroup).to receive_messages(:run! => double(:output => ""))
71
+ allow(described_class).to receive_messages(:run! => double(:output => ""))
74
72
  pv = described_class.create disk
75
- described_class.scan.should include(pv)
73
+ expect(described_class.scan).to include(pv)
76
74
  end
77
75
  end
78
76
 
79
77
  describe "#scan" do
80
78
  it "uses pvdisplay" do
81
- described_class.should_receive(:run!).
79
+ expect(described_class).to receive(:run!).
82
80
  with(LinuxAdmin.cmd(:pvdisplay),
83
81
  :params => { '-c' => nil}).
84
82
  and_return(double(:output => @physical_volumes))
85
- LinuxAdmin::VolumeGroup.should_receive(:run!).and_return(double(:output => @groups)) # stub out call to vgdisplay
83
+ expect(LinuxAdmin::VolumeGroup).to receive(:run!).and_return(double(:output => @groups)) # stub out call to vgdisplay
86
84
  described_class.scan
87
85
  end
88
86
 
89
87
  it "returns local physical volumes" do
90
- described_class.should_receive(:run!).and_return(double(:output => @physical_volumes))
91
- LinuxAdmin::VolumeGroup.should_receive(:run!).and_return(double(:output => @groups))
88
+ expect(described_class).to receive(:run!).and_return(double(:output => @physical_volumes))
89
+ expect(LinuxAdmin::VolumeGroup).to receive(:run!).and_return(double(:output => @groups))
92
90
  pvs = described_class.scan
93
91
 
94
- pvs[0].should be_an_instance_of(described_class)
95
- pvs[0].device_name.should == '/dev/vda2'
96
- pvs[0].size.should == 24139776
92
+ expect(pvs[0]).to be_an_instance_of(described_class)
93
+ expect(pvs[0].device_name).to eq('/dev/vda2')
94
+ expect(pvs[0].size).to eq(24139776)
97
95
  end
98
96
 
99
97
  it "resolves volume group references" do
100
- described_class.should_receive(:run!).and_return(double(:output => @physical_volumes))
101
- LinuxAdmin::VolumeGroup.should_receive(:run!).and_return(double(:output => @groups))
98
+ expect(described_class).to receive(:run!).and_return(double(:output => @physical_volumes))
99
+ expect(LinuxAdmin::VolumeGroup).to receive(:run!).and_return(double(:output => @groups))
102
100
  pvs = described_class.scan
103
- pvs[0].volume_group.should be_an_instance_of(LinuxAdmin::VolumeGroup)
104
- pvs[0].volume_group.name.should == 'vg_foobar'
101
+ expect(pvs[0].volume_group).to be_an_instance_of(LinuxAdmin::VolumeGroup)
102
+ expect(pvs[0].volume_group.name).to eq('vg_foobar')
105
103
  end
106
104
  end
107
105
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe LinuxAdmin::RegistrationSystem do
4
2
  context ".registration_type" do
5
3
  it "when registered Subscription Manager" do
@@ -18,13 +16,13 @@ describe LinuxAdmin::RegistrationSystem do
18
16
  end
19
17
 
20
18
  it "should memoize results" do
21
- described_class.should_receive(:registration_type_uncached).once.and_return("anything_non_nil")
19
+ expect(described_class).to receive(:registration_type_uncached).once.and_return("anything_non_nil")
22
20
  described_class.registration_type
23
21
  described_class.registration_type
24
22
  end
25
23
 
26
24
  it "with reload should refresh results" do
27
- described_class.should_receive(:registration_type_uncached).twice.and_return("anything_non_nil")
25
+ expect(described_class).to receive(:registration_type_uncached).twice.and_return("anything_non_nil")
28
26
  described_class.registration_type
29
27
  described_class.registration_type(true)
30
28
  end
@@ -32,7 +30,7 @@ describe LinuxAdmin::RegistrationSystem do
32
30
 
33
31
  it "#registered? when unregistered" do
34
32
  stub_registered_to_system(nil)
35
- expect(described_class.registered?).to be_false
33
+ expect(described_class.registered?).to be_falsey
36
34
  end
37
35
 
38
36
  context ".method_missing" do
@@ -41,7 +39,7 @@ describe LinuxAdmin::RegistrationSystem do
41
39
  end
42
40
 
43
41
  it "exists on the subclass" do
44
- expect(LinuxAdmin::RegistrationSystem.registered?).to be_true
42
+ expect(LinuxAdmin::RegistrationSystem.registered?).to be_truthy
45
43
  end
46
44
 
47
45
  it "does not exist on the subclass" do
@@ -49,12 +47,12 @@ describe LinuxAdmin::RegistrationSystem do
49
47
  end
50
48
 
51
49
  it "is an unknown method" do
52
- expect { LinuxAdmin::RegistrationSystem.method_does_not_exist }.to be_true
50
+ expect { LinuxAdmin::RegistrationSystem.method_does_not_exist }.to raise_error(NoMethodError)
53
51
  end
54
52
  end
55
53
 
56
54
  def stub_registered_to_system(*system)
57
- LinuxAdmin::SubscriptionManager.any_instance.stub(:registered? => (system.include?(:sm)))
58
- LinuxAdmin::Rhn.any_instance.stub(:registered? => (system.include?(:rhn)))
55
+ allow_any_instance_of(LinuxAdmin::SubscriptionManager).to receive_messages(:registered? => (system.include?(:sm)))
56
+ allow_any_instance_of(LinuxAdmin::Rhn).to receive_messages(:registered? => (system.include?(:rhn)))
59
57
  end
60
- end
58
+ end
data/spec/rhn_spec.rb CHANGED
@@ -1,19 +1,17 @@
1
- require 'spec_helper'
2
-
3
1
  describe LinuxAdmin::Rhn do
4
2
  context "#registered?" do
5
3
  it "with registered system_id" do
6
- described_class.any_instance.stub(:systemid_file => data_file_path("rhn/systemid"))
4
+ allow_any_instance_of(described_class).to receive_messages(:systemid_file => data_file_path("rhn/systemid"))
7
5
  expect(described_class.new).to be_registered
8
6
  end
9
7
 
10
8
  it "with unregistered system_id" do
11
- described_class.any_instance.stub(:systemid_file => data_file_path("rhn/systemid.missing_system_id"))
9
+ allow_any_instance_of(described_class).to receive_messages(:systemid_file => data_file_path("rhn/systemid.missing_system_id"))
12
10
  expect(described_class.new).to_not be_registered
13
11
  end
14
12
 
15
13
  it "with missing systemid file" do
16
- described_class.any_instance.stub(:systemid_file => data_file_path("rhn/systemid.missing_file"))
14
+ allow_any_instance_of(described_class).to receive_messages(:systemid_file => data_file_path("rhn/systemid.missing_file"))
17
15
  expect(described_class.new).to_not be_registered
18
16
  end
19
17
  end
@@ -41,25 +39,25 @@ describe LinuxAdmin::Rhn do
41
39
  run_params.store_path(:params, "--sslCACert=", "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT")
42
40
  base_options.store_path(:server_url, "https://server.url")
43
41
 
44
- described_class.any_instance.should_receive(:run!).once.with("rhnreg_ks", run_params)
45
- LinuxAdmin::Rpm.should_receive(:upgrade).with("http://server.url/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm")
46
- LinuxAdmin::Rpm.should_receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => "1.0"})
42
+ expect_any_instance_of(described_class).to receive(:run!).once.with("rhnreg_ks", run_params)
43
+ expect(LinuxAdmin::Rpm).to receive(:upgrade).with("http://server.url/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm")
44
+ expect(LinuxAdmin::Rpm).to receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => "1.0"})
47
45
 
48
46
  described_class.new.register(base_options)
49
47
  end
50
48
 
51
49
  it "without server_url" do
52
- described_class.any_instance.should_receive(:run!).once.with("rhnreg_ks", run_params)
53
- described_class.any_instance.should_not_receive(:install_server_certificate)
54
- LinuxAdmin::Rpm.should_receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => nil})
50
+ expect_any_instance_of(described_class).to receive(:run!).once.with("rhnreg_ks", run_params)
51
+ expect_any_instance_of(described_class).not_to receive(:install_server_certificate)
52
+ expect(LinuxAdmin::Rpm).to receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => nil})
55
53
 
56
54
  described_class.new.register(base_options)
57
55
  end
58
56
  end
59
57
 
60
58
  it "with activation key" do
61
- described_class.any_instance.should_receive(:run!).once.with("rhnreg_ks", {:params=>{"--activationkey="=>"123abc", "--proxy="=>"1.2.3.4", "--proxyUser="=>"ProxyUser", "--proxyPassword="=>"ProxyPass"}})
62
- LinuxAdmin::Rpm.should_receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => nil})
59
+ expect_any_instance_of(described_class).to receive(:run!).once.with("rhnreg_ks", {:params=>{"--activationkey="=>"123abc", "--proxy="=>"1.2.3.4", "--proxyUser="=>"ProxyUser", "--proxyPassword="=>"ProxyPass"}})
60
+ expect(LinuxAdmin::Rpm).to receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => nil})
63
61
 
64
62
  described_class.new.register(
65
63
  :activationkey => "123abc",
@@ -71,19 +69,19 @@ describe LinuxAdmin::Rhn do
71
69
  end
72
70
 
73
71
  it "#enable_channel" do
74
- described_class.any_instance.should_receive(:run!).once.with("rhn-channel -a", {:params=>{"--user="=>"SomeUser", "--password="=>"SomePass", "--channel="=>123}})
72
+ expect_any_instance_of(described_class).to receive(:run!).once.with("rhn-channel -a", {:params=>{"--user="=>"SomeUser", "--password="=>"SomePass", "--channel="=>123}})
75
73
 
76
74
  described_class.new.enable_channel(123, :username => "SomeUser", :password => "SomePass")
77
75
  end
78
76
 
79
77
  it "#enabled_channels" do
80
- described_class.any_instance.should_receive(:run!).once.with("rhn-channel -l").and_return(double(:output => sample_output("rhn/output_rhn-channel_list")))
78
+ expect_any_instance_of(described_class).to receive(:run!).once.with("rhn-channel -l").and_return(double(:output => sample_output("rhn/output_rhn-channel_list")))
81
79
 
82
80
  expect(described_class.new.enabled_channels).to eq(["rhel-x86_64-server-6", "rhel-x86_64-server-6-cf-me-2"])
83
81
  end
84
82
 
85
83
  it "#disable_channel" do
86
- described_class.any_instance.should_receive(:run!).once.with("rhn-channel -r", {:params=>{"--user="=>"SomeUser", "--password="=>"SomePass", "--channel="=>123}})
84
+ expect_any_instance_of(described_class).to receive(:run!).once.with("rhn-channel -r", {:params=>{"--user="=>"SomeUser", "--password="=>"SomePass", "--channel="=>123}})
87
85
 
88
86
  described_class.new.disable_channel(123, :username => "SomeUser", :password => "SomePass")
89
87
  end
@@ -107,7 +105,7 @@ describe LinuxAdmin::Rhn do
107
105
  }
108
106
  }
109
107
 
110
- described_class.any_instance.should_receive(:run!).once.with(cmd, params).and_return(double(:output => sample_output("rhn/output_rhn-channel_list_available")))
108
+ expect_any_instance_of(described_class).to receive(:run!).once.with(cmd, params).and_return(double(:output => sample_output("rhn/output_rhn-channel_list_available")))
111
109
 
112
110
  expect(described_class.new.available_channels(credentials)).to eq(expected)
113
111
  end
@@ -125,8 +123,8 @@ describe LinuxAdmin::Rhn do
125
123
  {:repo_id => "rhel-x86_64-server-6", :enabled => true}
126
124
  ]
127
125
 
128
- described_class.any_instance.should_receive(:run!).once.and_return(double(:output => sample_output("rhn/output_rhn-channel_list_available")))
129
- described_class.any_instance.should_receive(:run!).once.with("rhn-channel -l").and_return(double(:output => sample_output("rhn/output_rhn-channel_list")))
126
+ expect_any_instance_of(described_class).to receive(:run!).once.and_return(double(:output => sample_output("rhn/output_rhn-channel_list_available")))
127
+ expect_any_instance_of(described_class).to receive(:run!).once.with("rhn-channel -l").and_return(double(:output => sample_output("rhn/output_rhn-channel_list")))
130
128
 
131
129
  expect(described_class.new.all_repos(credentials)).to eq(expected)
132
130
  end
data/spec/rpm_spec.rb CHANGED
@@ -1,8 +1,6 @@
1
- require 'spec_helper'
2
-
3
1
  describe LinuxAdmin::Rpm do
4
2
  it ".list_installed" do
5
- described_class.stub(:run! => double(:output => sample_output("rpm/cmd_output_for_list_installed")))
3
+ allow(described_class).to receive_messages(:run! => double(:output => sample_output("rpm/cmd_output_for_list_installed")))
6
4
  expect(described_class.list_installed).to eq({
7
5
  "ruby193-rubygem-some_really_long_name" =>"1.0.7-1.el6",
8
6
  "fipscheck-lib" =>"1.2.0-7.el6",
@@ -28,7 +26,7 @@ describe LinuxAdmin::Rpm do
28
26
  end
29
27
 
30
28
  it ".import_key" do
31
- described_class.should_receive(:run!).with("rpm", {:params => {"--import" => "abc"}})
29
+ expect(described_class).to receive(:run!).with("rpm", {:params => {"--import" => "abc"}})
32
30
  expect { described_class.import_key("abc") }.to_not raise_error
33
31
  end
34
32
 
@@ -61,25 +59,25 @@ straight-forward, and extensible.
61
59
  EOS
62
60
  arguments = [described_class.rpm_cmd, :params => {"-qi" => "ruby"}]
63
61
  result = AwesomeSpawn::CommandResult.new("", data, "", 0)
64
- described_class.should_receive(:run!).with(*arguments).and_return(result)
62
+ expect(described_class).to receive(:run!).with(*arguments).and_return(result)
65
63
  metadata = described_class.info("ruby")
66
- metadata['name'].should == 'ruby'
67
- metadata['version'].should == '2.0.0.247'
68
- metadata['release'].should == '15.fc19'
69
- metadata['architecture'].should == 'x86_64'
70
- metadata['group'].should == 'Development/Languages'
71
- metadata['size'].should == '64473'
72
- metadata['license'].should == '(Ruby or BSD) and Public Domain'
73
- metadata['source_rpm'].should == 'ruby-2.0.0.247-15.fc19.src.rpm'
74
- metadata['build_host'].should == 'buildvm-16.phx2.fedoraproject.org'
75
- metadata['packager'].should == 'Fedora Project'
76
- metadata['vendor'].should == 'Fedora Project'
77
- metadata['summary'].should == 'An interpreter of object-oriented scripting language'
64
+ expect(metadata['name']).to eq('ruby')
65
+ expect(metadata['version']).to eq('2.0.0.247')
66
+ expect(metadata['release']).to eq('15.fc19')
67
+ expect(metadata['architecture']).to eq('x86_64')
68
+ expect(metadata['group']).to eq('Development/Languages')
69
+ expect(metadata['size']).to eq('64473')
70
+ expect(metadata['license']).to eq('(Ruby or BSD) and Public Domain')
71
+ expect(metadata['source_rpm']).to eq('ruby-2.0.0.247-15.fc19.src.rpm')
72
+ expect(metadata['build_host']).to eq('buildvm-16.phx2.fedoraproject.org')
73
+ expect(metadata['packager']).to eq('Fedora Project')
74
+ expect(metadata['vendor']).to eq('Fedora Project')
75
+ expect(metadata['summary']).to eq('An interpreter of object-oriented scripting language')
78
76
  end
79
77
  end
80
78
 
81
79
  it ".upgrade" do
82
- described_class.should_receive(:run).with("rpm -U", {:params=>{nil=>"abc"}}).and_return(double(:exit_status => 0))
83
- expect(described_class.upgrade("abc")).to be_true
80
+ expect(described_class).to receive(:run).with("rpm -U", {:params=>{nil=>"abc"}}).and_return(double(:exit_status => 0))
81
+ expect(described_class.upgrade("abc")).to be_truthy
84
82
  end
85
83
  end
data/spec/service_spec.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe LinuxAdmin::Service do
4
2
  before(:each) do
5
3
  @service = LinuxAdmin::Service.new 'foo'
@@ -7,7 +5,7 @@ describe LinuxAdmin::Service do
7
5
 
8
6
  describe "#running?" do
9
7
  it "checks service" do
10
- @service.should_receive(:run).
8
+ expect(@service).to receive(:run).
11
9
  with(@service.cmd(:service),
12
10
  :params => { nil => ['foo', 'status']}).and_return(double(:exit_status => 0))
13
11
  @service.running?
@@ -16,79 +14,79 @@ describe LinuxAdmin::Service do
16
14
  context "service is running" do
17
15
  it "returns true" do
18
16
  @service = LinuxAdmin::Service.new :id => :foo
19
- @service.should_receive(:run).and_return(double(:exit_status => 0))
20
- @service.should be_running
17
+ expect(@service).to receive(:run).and_return(double(:exit_status => 0))
18
+ expect(@service).to be_running
21
19
  end
22
20
  end
23
21
 
24
22
  context "service is not running" do
25
23
  it "returns false" do
26
24
  @service = LinuxAdmin::Service.new :id => :foo
27
- @service.should_receive(:run).and_return(double(:exit_status => 1))
28
- @service.should_not be_running
25
+ expect(@service).to receive(:run).and_return(double(:exit_status => 1))
26
+ expect(@service).not_to be_running
29
27
  end
30
28
  end
31
29
  end
32
30
 
33
31
  describe "#enable" do
34
32
  it "enables service" do
35
- @service.should_receive(:run!).
33
+ expect(@service).to receive(:run!).
36
34
  with(@service.cmd(:chkconfig),
37
35
  :params => { nil => [ 'foo', 'on']})
38
36
  @service.enable
39
37
  end
40
38
 
41
39
  it "returns self" do
42
- @service.should_receive(:run!) # stub out cmd invocation
43
- @service.enable.should == @service
40
+ expect(@service).to receive(:run!) # stub out cmd invocation
41
+ expect(@service.enable).to eq(@service)
44
42
  end
45
43
  end
46
44
 
47
45
  describe "#disable" do
48
46
  it "disable service" do
49
- @service.should_receive(:run!).
47
+ expect(@service).to receive(:run!).
50
48
  with(@service.cmd(:chkconfig),
51
49
  :params => { nil => [ 'foo', 'off']})
52
50
  @service.disable
53
51
  end
54
52
 
55
53
  it "returns self" do
56
- @service.should_receive(:run!)
57
- @service.disable.should == @service
54
+ expect(@service).to receive(:run!)
55
+ expect(@service.disable).to eq(@service)
58
56
  end
59
57
  end
60
58
 
61
59
  describe "#start" do
62
60
  it "starts service" do
63
- @service.should_receive(:run!).
61
+ expect(@service).to receive(:run!).
64
62
  with(@service.cmd(:service),
65
63
  :params => { nil => [ 'foo', 'start']})
66
64
  @service.start
67
65
  end
68
66
 
69
67
  it "returns self" do
70
- @service.should_receive(:run!)
71
- @service.start.should == @service
68
+ expect(@service).to receive(:run!)
69
+ expect(@service.start).to eq(@service)
72
70
  end
73
71
  end
74
72
 
75
73
  describe "#stop" do
76
74
  it "stops service" do
77
- @service.should_receive(:run!).
75
+ expect(@service).to receive(:run!).
78
76
  with(@service.cmd(:service),
79
77
  :params => { nil => [ 'foo', 'stop']})
80
78
  @service.stop
81
79
  end
82
80
 
83
81
  it "returns self" do
84
- @service.should_receive(:run!)
85
- @service.stop.should == @service
82
+ expect(@service).to receive(:run!)
83
+ expect(@service.stop).to eq(@service)
86
84
  end
87
85
  end
88
86
 
89
87
  describe "#restart" do
90
88
  it "stops service" do
91
- @service.should_receive(:run).
89
+ expect(@service).to receive(:run).
92
90
  with(@service.cmd(:service),
93
91
  :params => { nil => [ 'foo', 'restart']}).and_return(double(:exit_status => 0))
94
92
  @service.restart
@@ -96,16 +94,16 @@ describe LinuxAdmin::Service do
96
94
 
97
95
  context "service restart fails" do
98
96
  it "manually stops/starts service" do
99
- @service.should_receive(:run).and_return(double(:exit_status => 1))
100
- @service.should_receive(:stop)
101
- @service.should_receive(:start)
97
+ expect(@service).to receive(:run).and_return(double(:exit_status => 1))
98
+ expect(@service).to receive(:stop)
99
+ expect(@service).to receive(:start)
102
100
  @service.restart
103
101
  end
104
102
  end
105
103
 
106
104
  it "returns self" do
107
- @service.should_receive(:run).and_return(double(:exit_status => 0))
108
- @service.restart.should == @service
105
+ expect(@service).to receive(:run).and_return(double(:exit_status => 0))
106
+ expect(@service.restart).to eq(@service)
109
107
  end
110
108
  end
111
109