Prefer attributes_for_keys so that it ignores nils
Also add a test for setting locked.
This commit is contained in:
parent
894d22f49a
commit
781d35c191
2 changed files with 7 additions and 9 deletions
|
@ -28,13 +28,9 @@ module Ci
|
||||||
post "register" do
|
post "register" do
|
||||||
required_attributes! [:token]
|
required_attributes! [:token]
|
||||||
|
|
||||||
attributes = { description: params[:description],
|
attributes = attributes_for_keys(
|
||||||
tag_list: params[:tag_list],
|
[:description, :tag_list, :run_untagged, :locked]
|
||||||
locked: !!params[:locked] }
|
)
|
||||||
|
|
||||||
unless params[:run_untagged].nil?
|
|
||||||
attributes[:run_untagged] = params[:run_untagged]
|
|
||||||
end
|
|
||||||
|
|
||||||
runner =
|
runner =
|
||||||
if runner_registration_token_valid?
|
if runner_registration_token_valid?
|
||||||
|
|
|
@ -187,14 +187,16 @@ describe API::Runners, api: true do
|
||||||
update_runner(shared_runner.id, admin, description: "#{description}_updated",
|
update_runner(shared_runner.id, admin, description: "#{description}_updated",
|
||||||
active: !active,
|
active: !active,
|
||||||
tag_list: ['ruby2.1', 'pgsql', 'mysql'],
|
tag_list: ['ruby2.1', 'pgsql', 'mysql'],
|
||||||
run_untagged: 'false')
|
run_untagged: 'false',
|
||||||
|
locked: 'true')
|
||||||
shared_runner.reload
|
shared_runner.reload
|
||||||
|
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(200)
|
||||||
expect(shared_runner.description).to eq("#{description}_updated")
|
expect(shared_runner.description).to eq("#{description}_updated")
|
||||||
expect(shared_runner.active).to eq(!active)
|
expect(shared_runner.active).to eq(!active)
|
||||||
expect(shared_runner.tag_list).to include('ruby2.1', 'pgsql', 'mysql')
|
expect(shared_runner.tag_list).to include('ruby2.1', 'pgsql', 'mysql')
|
||||||
expect(shared_runner.run_untagged?).to be false
|
expect(shared_runner.run_untagged?).to be(false)
|
||||||
|
expect(shared_runner.locked?).to be(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue