chore: Automation bug fix (#4442)

This commit is contained in:
Tejaswini Chile
2022-04-12 20:23:34 +05:30
committed by GitHub
parent b6ad468eb4
commit 923b4637db
12 changed files with 47 additions and 164 deletions

View File

@@ -259,7 +259,7 @@ RSpec.describe 'Api::V1::Accounts::AutomationRulesController', type: :request do
end
context 'when it is an authenticated user' do
it 'returns for cloned automation_rule for account' do
it 'returns for updated automation_rule for account' do
params = { name: 'Update name' }
expect(account.automation_rules.count).to eq(1)
@@ -271,6 +271,20 @@ RSpec.describe 'Api::V1::Accounts::AutomationRulesController', type: :request do
body = JSON.parse(response.body, symbolize_names: true)
expect(body[:payload][:name]).to eq('Update name')
end
it 'returns for updated active flag for automation_rule' do
expect(automation_rule.active).to eq(true)
params = { active: false }
patch "/api/v1/accounts/#{account.id}/automation_rules/#{automation_rule.id}",
headers: administrator.create_new_auth_token,
params: params
expect(response).to have_http_status(:success)
body = JSON.parse(response.body, symbolize_names: true)
expect(body[:payload][:active]).to eq(false)
expect(automation_rule.reload.active).to eq(false)
end
end
end