I have defined param below in my spec file:
let(:params) do
{
company: {
name: "My company",
company_type_ids: [1,2]
}
}
end
There's no problem when I send request with the same param by postman, but when calling post request with rspec array of int in param is converted to string, like this: company_type_ids: ["1", "2"]
It should be company_type_ids: [1,2]
How can I prevent that array in param to be converted to string?
Many thanks!
CompanyType.find(id: params[:company_type_ids]. No need to convert string to integer.CONTENT_TYPEto beapplication/json.