fix: Use to_i in campaign scheduled_at key (#3968)

This commit is contained in:
Tejaswini Chile 2022-02-14 11:20:31 +05:30 committed by GitHub
parent 2da618bd5e
commit 25001689ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -13,7 +13,7 @@ json.campaign_status resource.campaign_status
json.enabled resource.enabled
json.campaign_type resource.campaign_type
if resource.campaign_type == 'one_off'
json.scheduled_at resource.scheduled_at
json.scheduled_at resource.scheduled_at.to_i
json.audience resource.audience
end
json.trigger_rules resource.trigger_rules

View file

@ -145,6 +145,7 @@ RSpec.describe 'Campaigns API', type: :request do
response_data = JSON.parse(response.body, symbolize_names: true)
expect(response_data[:campaign_type]).to eq('one_off')
expect(response_data[:scheduled_at].present?).to eq true
expect(response_data[:scheduled_at]).to eq(2.days.from_now.to_i)
expect(response_data[:audience].pluck(:id)).to include(label1.id, label2.id)
end
end