mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 20:48:07 +00:00
chore: Automation bug fix (#4442)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user