Commit fc115968 authored by James Fargher's avatar James Fargher

Merge branch...

Merge branch '227363-project-services-checkboxes-are-not-checked-with-feature-flag-integration_form_refactor' into 'master'

Fix wrong value of checkbox in integration form

See merge request gitlab-org/gitlab!36329
parents 4a513828 2d33bd9d
......@@ -11,6 +11,8 @@ class ServiceFieldEntity < Grape::Entity
if field[:type] == 'password' && value.present?
'true'
elsif field[:type] == 'checkbox'
ActiveRecord::Type::Boolean.new.deserialize(value).to_s
else
value
end
......
---
title: Fix wrong value of checkbox in integration form
merge_request: 36329
author:
type: fixed
......@@ -55,12 +55,12 @@ RSpec.describe ServiceFieldEntity do
end
context 'EmailsOnPush Service' do
let(:service) { create(:emails_on_push_service) }
let(:service) { create(:emails_on_push_service, send_from_committer_email: '1') }
context 'field with type checkbox' do
let(:field) { service.global_fields.find { |field| field[:name] == 'send_from_committer_email' } }
it 'exposes correct attributes' do
it 'exposes correct attributes and casts value to Boolean' do
expected_hash = {
type: 'checkbox',
name: 'send_from_committer_email',
......@@ -68,7 +68,7 @@ RSpec.describe ServiceFieldEntity do
placeholder: nil,
required: nil,
choices: nil,
value: true
value: 'true'
}
is_expected.to include(expected_hash)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment