Skip to content

Commit

Permalink
Corrige lógica de conversão para booleano no método to_b em lead.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
gildemberg-santos committed Apr 28, 2024
1 parent 02fc22a commit 5b0b11e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/salesforce/lead.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def field!
remove_fields = %w[FirstName LastName].include?(field["name"])
createable = field["createable"] == false
remove_type = %w[reference].include?(field["type"])
remove_required = field["nillable"] == false && field["type"] != "boolean"
@fields.merge!({ field["name"] => { "type" => field["type"], "title" => field["label"] } })

next if (not_remove_fields && createable) || (not_remove_fields && remove_type) || remove_fields
Expand All @@ -79,7 +80,7 @@ def field!
field_temp[field["name"]].merge!(create_enum(field["picklistValues"]))
end

@required_fields.append(field["name"]) if field["nillable"] == false
@required_fields.append(field["name"]) if remove_required
@normalized_fields.merge!(field_temp)
end
nil
Expand Down
2 changes: 2 additions & 0 deletions spec/lib/salesforce/lead_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@
@lead.send({ "Company" => "Test", "LastName" => "Test" })["success"]
).to eq true
}

it { expect(@lead.required_fields).to eq(%w[Name Company Status]) }
end

0 comments on commit 5b0b11e

Please sign in to comment.