after im upgrading to rails 7 and ruby 3, I'm facing one issue in rspec.
issue: whenever I'm using the update_column of date field of a column of the model in rspec, it shows the result of the update as true, but that value is not getting updated in the database.
Example:
My model. Dishes
it contains prepared time, and served time as date field: structure.sql file.
CREATE TABLE public.dishes (
....
....
prepared_time date,
served_time date,
......
)
my rspec
it "should send notification on updating served time" do
dish.update_column(:prepared_date, (Time.zone.now).strftime('%m/%d/%Y'))
params['orders'].merge!(served_time: [(Time.zone.now +
3.day).strftime('%m/%d/%Y')])
response = put(:update, params)
json = JSON.parse(response.body)
expect(json).to eq(success_response)
end
here after debugging im found that the dish is not updated with prepared_date, as the prepared_date is nil, but when I try to update other fields, they are getting updated.
But the same spec works on rails 4.
what might be the reason??
Aucun commentaire:
Enregistrer un commentaire