spec/hosts_spec.rb in linux_admin-0.9.1 vs spec/hosts_spec.rb in linux_admin-0.9.2
- old
+ new
@@ -1,11 +1,9 @@
-require 'spec_helper'
-
describe LinuxAdmin::Hosts do
etc_hosts = "\n #Some Comment\n127.0.0.1\tlocalhost localhost.localdomain # with a comment\n127.0.1.1 my.domain.local"
before do
- File.stub(:read).and_return(etc_hosts)
+ allow(File).to receive(:read).and_return(etc_hosts)
@instance = LinuxAdmin::Hosts.new
end
describe "#reload" do
it "sets raw_lines" do
@@ -33,11 +31,11 @@
end
end
describe "#save" do
before do
- File.stub(:write)
+ allow(File).to receive(:write)
end
it "properly generates file with new content" do
expected_array = ["", "#Some Comment", "127.0.0.1 localhost localhost.localdomain #with a comment", "127.0.1.1 my.domain.local", "1.2.3.4 test"]
@instance.update_entry("1.2.3.4", "test")
@@ -50,6 +48,6 @@
@instance.update_entry("127.0.0.1", "my.domain.local")
@instance.save
expect(@instance.raw_lines).to eq(expected_array)
end
end
-end
\ No newline at end of file
+end