From 8e334d2f24b23c327a5aa80b2f5f0ec8bd6493ec Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 5 May 2014 09:29:23 -0700 Subject: [PATCH] guests/debian: fix tests --- .../guests/support/shared/debian_like_host_name_examples.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/unit/plugins/guests/support/shared/debian_like_host_name_examples.rb b/test/unit/plugins/guests/support/shared/debian_like_host_name_examples.rb index b7ae47929..5b59c76a5 100644 --- a/test/unit/plugins/guests/support/shared/debian_like_host_name_examples.rb +++ b/test/unit/plugins/guests/support/shared/debian_like_host_name_examples.rb @@ -28,6 +28,12 @@ shared_examples "a debian-like host name change" do let(:search) { Regexp.new(expression.split('@')[1], Regexp::EXTENDED) } let(:replace) { expression.split('@')[2] } + let(:grep_command) { "grep '#{old_hostname}' /etc/hosts" } + + before do + communicator.stub_command(grep_command, exit_code: 0) + end + it "works on an simple /etc/hosts file" do original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '') 127.0.0.1 localhost