Skip to content

Commit c240fd3

Browse files
committed
(CONT-809) Fixing failing ruby 3 spec tests. Ruby 3 no longer allows variables to passed to a function as a hash. The quick fix is to prefix the hash (params) with **
1 parent a6ff003 commit c240fd3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spec/tasks/abs_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def with_env(env_vars)
9292
stub_request(:post, 'https://abs-prod.k8s.infracore.puppet.net/api/v2/request')
9393
.to_return({ status: 202 }, { status: 200, body: response_body.to_json })
9494

95-
expect(abs.task(params)).to eq({ status: 'ok', nodes: 1 })
95+
expect(abs.task(**params)).to eq({ status: 'ok', nodes: 1 })
9696

9797
updated_inventory = YAML.load_file(inventory_file)
9898
ssh_targets = updated_inventory['groups'].find { |g| g['name'] == 'ssh_nodes' }['targets']
@@ -105,7 +105,7 @@ def with_env(env_vars)
105105
.to_return({ status: 202 }, { status: 200, body: response_body.to_json })
106106

107107
with_env('ABS_SUBDOMAIN' => 'abs-spec') do
108-
expect(abs.task(params)).to eq({ status: 'ok', nodes: 1 })
108+
expect(abs.task(**params)).to eq({ status: 'ok', nodes: 1 })
109109
end
110110
end
111111

@@ -115,7 +115,7 @@ def with_env(env_vars)
115115

116116
File.write(inventory_file, empty_inventory_yaml)
117117

118-
expect(abs.task(params)).to eq({ status: 'ok', nodes: 1 })
118+
expect(abs.task(**params)).to eq({ status: 'ok', nodes: 1 })
119119
end
120120

121121
it 'raises an error if abs returns error response'
@@ -152,7 +152,7 @@ def with_env(env_vars)
152152
stub_request(:post, 'https://abs-prod.k8s.infracore.puppet.net/api/v2/return')
153153
.to_return(status: 200)
154154

155-
expect(abs.task(params)).to eq({ status: 'ok', removed: ['foo-bar.test'] })
155+
expect(abs.task(**params)).to eq({ status: 'ok', removed: ['foo-bar.test'] })
156156
expect(YAML.load_file(inventory_file)).to eq(YAML.safe_load(empty_inventory_yaml))
157157
end
158158

@@ -162,7 +162,7 @@ def with_env(env_vars)
162162
.to_return(status: 200)
163163

164164
with_env('ABS_SUBDOMAIN' => 'abs-spec') do
165-
expect(abs.task(params)).to eq({ status: 'ok', removed: ['foo-bar.test'] })
165+
expect(abs.task(**params)).to eq({ status: 'ok', removed: ['foo-bar.test'] })
166166
end
167167
end
168168

0 commit comments

Comments
 (0)