Skip to content

Commit

Permalink
Updated testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Oct 10, 2017
1 parent 173f5b1 commit c3ea645
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/address_test.rb
Expand Up @@ -128,4 +128,28 @@ def initialize
end
end

describe "#update_hostname" do
let(:ip) { "1.1.1.1" }
let(:initial_hostname) { "initial.hostname.com" }
let(:new_hostname) { "new.hostname.com" }

it "drops old /etc/hosts record if hostname was changed" do
allow(Yast::LanItems)
.to receive(:ipaddr)
.and_return(ip)
allow(subject)
.to receive(:hostname_initial)
.and_return(initial_hostname)

expect(Yast::Host)
.to receive(:remove_ip)
.with(ip)
expect(Yast::Host)
.to receive(:Update)
.with(initial_hostname, new_hostname, ip)

subject.send(:update_hostname, ip, new_hostname)
end
end

end

0 comments on commit c3ea645

Please sign in to comment.