Skip to content

Commit ddba403

Browse files
committed
Merge pull request #238 from kbrock/fix_awesomespawn_specs
Fix AwesomeSpawn spec failures
2 parents c0854bf + 2b9d29f commit ddba403

File tree

8 files changed

+15
-17
lines changed

8 files changed

+15
-17
lines changed

spec/hosts_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@
136136
end
137137

138138
it "returns the hostname" do
139-
result = AwesomeSpawn::CommandResult.new("", TEST_HOSTNAME, nil, 0)
139+
result = AwesomeSpawn::CommandResult.new("", TEST_HOSTNAME, "", 55, 0)
140140
expect(AwesomeSpawn).to receive(:run).with(*spawn_args).and_return(result)
141141
expect(@instance.hostname).to eq(TEST_HOSTNAME)
142142
end
143143

144144
it "returns nil when the command fails" do
145-
result = AwesomeSpawn::CommandResult.new("", "", "An error has happened", 1)
145+
result = AwesomeSpawn::CommandResult.new("", "", "An error has happened", 55, 1)
146146
expect(AwesomeSpawn).to receive(:run).with(*spawn_args).and_return(result)
147147
expect(@instance.hostname).to be_nil
148148
end

spec/ip_address_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
IP_OUT
5050

5151
def result(output, exit_status)
52-
AwesomeSpawn::CommandResult.new("", output, "", exit_status)
52+
AwesomeSpawn::CommandResult.new("", output, "", 55, exit_status)
5353
end
5454

5555
describe "#address" do

spec/network_interface/network_interface_rh_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def stub_foreach_to_string(string)
3434
end
3535

3636
def result(output, exit_status)
37-
AwesomeSpawn::CommandResult.new("", output, "", exit_status)
37+
AwesomeSpawn::CommandResult.new("", output, "", 55, exit_status)
3838
end
3939

4040
subject(:dhcp_interface) do

spec/network_interface_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
end
147147

148148
def result(output, exit_status)
149-
AwesomeSpawn::CommandResult.new("", output, "", exit_status)
149+
AwesomeSpawn::CommandResult.new("", output, "", nil, exit_status)
150150
end
151151

152152
describe "#reload" do

spec/rpm_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
straight-forward, and extensible.
6060
EOS
6161
arguments = [described_class.rpm_cmd, :params => {"-qi" => "ruby"}]
62-
result = AwesomeSpawn::CommandResult.new("", data, "", 0)
62+
result = AwesomeSpawn::CommandResult.new("", data, "", 55, 0)
6363
expect(LinuxAdmin::Common).to receive(:run!).with(*arguments).and_return(result)
6464
metadata = described_class.info("ruby")
6565
expect(metadata['name']).to eq('ruby')

spec/subscription_manager_spec.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
describe LinuxAdmin::SubscriptionManager do
22
context "#run!" do
33
it "raises a CredentialError if the error message contained a credential error" do
4-
result = AwesomeSpawn::CommandResult.new("stuff", "things", "invalid username or password", 1)
4+
result = AwesomeSpawn::CommandResult.new("stuff", "things", "invalid username or password", 55, 1)
55
err = AwesomeSpawn::CommandResultError.new("things", result)
66
expect(LinuxAdmin::Common).to receive(:run!).and_raise(err)
77

88
expect { subject.run!("stuff") }.to raise_error(LinuxAdmin::CredentialError)
99
end
1010

1111
it "raises a SubscriptionManagerError if the error message does not contain a credential error" do
12-
result = AwesomeSpawn::CommandResult.new("stuff", "things", "not a credential error", 1)
12+
result = AwesomeSpawn::CommandResult.new("stuff", "things", "not a credential error", 55, 1)
1313
err = AwesomeSpawn::CommandResultError.new("things", result)
1414
expect(LinuxAdmin::Common).to receive(:run!).and_raise(err)
1515

@@ -205,12 +205,10 @@
205205

206206
it "with invalid credentials" do
207207
run_options = ["subscription-manager orgs", {:params => {"--username=" => "BadUser", "--password=" => "BadPass"}}]
208+
result = AwesomeSpawn::CommandResult.new("", "", "Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html", 55, 255)
208209
error = AwesomeSpawn::CommandResultError.new(
209210
"",
210-
double(
211-
:error => "Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html",
212-
:exit_status => 255
213-
)
211+
result
214212
)
215213
expect(AwesomeSpawn).to receive(:run!).once.with(*run_options).and_raise(error)
216214
expect { described_class.new.organizations({:username => "BadUser", :password => "BadPass"}) }.to raise_error(LinuxAdmin::CredentialError)

spec/time_date_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def timedatectl_result
55
output = File.read(Pathname.new(data_file_path("time_date/timedatectl_output")))
6-
AwesomeSpawn::CommandResult.new("", output, "", 0)
6+
AwesomeSpawn::CommandResult.new("", output, "", 55, 0)
77
end
88

99
describe ".system_timezone_detailed" do
@@ -56,7 +56,7 @@ def timedatectl_result
5656
RUN_COMMAND,
5757
:params => ["list-timezones"]
5858
]
59-
result = AwesomeSpawn::CommandResult.new("", timezones, "", 0)
59+
result = AwesomeSpawn::CommandResult.new("", timezones, "", 55, 0)
6060
expect(AwesomeSpawn).to receive(:run!).with(*awesome_spawn_args).and_return(result)
6161
expect(described_class.timezones).to eq(timezones.split("\n"))
6262
end

spec/yum_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,18 @@
9797
context ".update" do
9898
it "no arguments" do
9999
expect(LinuxAdmin::Common).to receive(:run!).once.with("yum -y update", :params => nil)
100-
.and_return(AwesomeSpawn::CommandResult.new("", "", "", 0))
100+
.and_return(AwesomeSpawn::CommandResult.new("", "", "", 55, 0))
101101
described_class.update
102102
end
103103

104104
it "with arguments" do
105105
expect(LinuxAdmin::Common).to receive(:run!).once.with("yum -y update", :params => {nil => ["1 2", "3"]})
106-
.and_return(AwesomeSpawn::CommandResult.new("", "", "", 0))
106+
.and_return(AwesomeSpawn::CommandResult.new("", "", "", 55, 0))
107107
described_class.update("1 2", "3")
108108
end
109109

110110
it "with bad arguments" do
111-
error = AwesomeSpawn::CommandResult.new("", "Loaded plugins: product-id\nNo Packages marked for Update\n", "Blah blah ...\nNo Match for argument: \n", 0)
111+
error = AwesomeSpawn::CommandResult.new("", "Loaded plugins: product-id\nNo Packages marked for Update\n", "Blah blah ...\nNo Match for argument: \n", 55, 0)
112112
expect(LinuxAdmin::Common).to receive(:run!).once
113113
.with("yum -y update", :params => {nil => [""]}).and_return(error)
114114
expect { described_class.update("") }.to raise_error(AwesomeSpawn::CommandResultError)

0 commit comments

Comments
 (0)