fix: Condition based backend validation (#6554)

This commit is contained in:
Tejaswini Chile
2023-02-27 20:22:07 +05:30
committed by GitHub
parent b76fda53a2
commit ce807d3251
2 changed files with 15 additions and 0 deletions

View File

@@ -48,5 +48,12 @@ RSpec.describe AutomationRule, type: :model do
rule = FactoryBot.build(:automation_rule, params)
expect(rule.valid?).to be true
end
it 'returns invalid record' do
params[:conditions][0].delete('query_operator')
rule = FactoryBot.build(:automation_rule, params)
expect(rule.valid?).to be false
expect(rule.errors.messages[:conditions]).to eq(['Automation conditions should have query operator.'])
end
end
end