chore: Enable the new Rubocop rules (#7122)

fixes: https://linear.app/chatwoot/issue/CW-1574/renable-the-disabled-rubocop-rules
This commit is contained in:
Sojan Jose
2023-05-19 14:37:10 +05:30
committed by GitHub
parent b988a01df3
commit 7ab7bac6bf
215 changed files with 609 additions and 608 deletions

View File

@@ -30,7 +30,7 @@ RSpec.describe 'Contact Merge Action API', type: :request do
as: :json
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['id']).to eq(base_contact.id)
expected_params = { account: account, base_contact: base_contact, mergee_contact: mergee_contact }
expect(ContactMergeAction).to have_received(:new).with(expected_params)

View File

@@ -25,7 +25,7 @@ RSpec.describe 'Agents API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body).size).to eq(account.users.count)
expect(response.parsed_body.size).to eq(account.users.count)
end
it 'returns custom fields on agents if present' do
@@ -36,7 +36,7 @@ RSpec.describe 'Agents API', type: :request do
as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data.first['custom_attributes']['test']).to eq('test')
end
end
@@ -131,7 +131,7 @@ RSpec.describe 'Agents API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body)
response_data = response.parsed_body
expect(response_data['role']).to eq('administrator')
expect(response_data['availability_status']).to eq('busy')
expect(response_data['auto_offline']).to be(false)

View File

@@ -35,7 +35,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
params: article_params,
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['title']).to eql('MyTitle')
expect(json_response['payload']['status']).to eql('draft')
expect(json_response['payload']['position']).to be(3)
@@ -58,7 +58,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
params: article_params,
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['title']).to eql('MyTitle')
expect(json_response['payload']['status']).to eql('draft')
expect(json_response['payload']['position']).to be(3)
@@ -86,7 +86,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
params: article_params,
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['title']).to eql('MyTitle')
category = Article.find(json_response['payload']['id'])
@@ -112,7 +112,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
params: article_params,
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['title']).to eql('MyTitle')
category = Article.find(json_response['payload']['id'])
@@ -146,7 +146,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
params: article_params,
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['title']).to eql(article_params[:article][:title])
expect(json_response['payload']['status']).to eql(article_params[:article][:status])
expect(json_response['payload']['position']).to eql(article_params[:article][:position])
@@ -190,7 +190,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
headers: agent.create_new_auth_token,
params: {}
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload'].count).to be 2
end
@@ -202,7 +202,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
headers: agent.create_new_auth_token,
params: { category_slug: category.slug }
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload'].count).to be 2
end
@@ -219,7 +219,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
headers: agent.create_new_auth_token,
params: { query: 'funny' }
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload'].count).to be 1
expect(json_response['meta']['all_articles_count']).to be 2
expect(json_response['meta']['articles_count']).to be 1
@@ -235,7 +235,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
get "/api/v1/accounts/#{account.id}/portals/#{portal.slug}/articles/#{article2.id}",
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['title']).to eq(article2.title)
expect(json_response['payload']['id']).to eq(article2.id)
@@ -251,11 +251,11 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
get "/api/v1/accounts/#{account.id}/portals/#{portal.slug}/articles/#{root_article.id}",
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['associated_articles'].length).to eq(2)
associated_articles_ids = json_response['payload']['associated_articles'].map { |article| article['id'] }
expect(associated_articles_ids).to match_array([child_article_1.id, child_article_2.id])
associated_articles_ids = json_response['payload']['associated_articles'].pluck('id')
expect(associated_articles_ids).to contain_exactly(child_article_1.id, child_article_2.id)
expect(json_response['payload']['id']).to eq(root_article.id)
end
end
@@ -272,7 +272,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
expect(response).to have_http_status(:success)
blob = JSON.parse(response.body)
blob = response.parsed_body
expect(blob['file_url']).to be_present
end

View File

@@ -134,7 +134,7 @@ RSpec.describe 'Api::V1::Accounts::AutomationRulesController', type: :request do
expect(response).to have_http_status(:success)
blob = JSON.parse(response.body)
blob = response.parsed_body
expect(blob['blob_key']).to be_present
expect(blob['blob_id']).to be_present
@@ -167,13 +167,13 @@ RSpec.describe 'Api::V1::Accounts::AutomationRulesController', type: :request do
headers: administrator.create_new_auth_token,
params: { attachment: file_1 }
blob_1 = JSON.parse(response.body)
blob_1 = response.parsed_body
post "/api/v1/accounts/#{account.id}/automation_rules/attach_file",
headers: administrator.create_new_auth_token,
params: { attachment: file_2 }
blob_2 = JSON.parse(response.body)
blob_2 = response.parsed_body
params[:actions] = [
{

View File

@@ -222,7 +222,7 @@ RSpec.describe 'Campaigns API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(::Campaign.exists?(campaign.display_id)).to be false
expect(Campaign.exists?(campaign.display_id)).to be false
end
end
end

View File

@@ -25,7 +25,7 @@ RSpec.describe 'Canned Responses API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body)).to eq(account.canned_responses.as_json)
expect(response.parsed_body).to eq(account.canned_responses.as_json)
end
it 'returns all the canned responses the user searched for' do
@@ -42,7 +42,7 @@ RSpec.describe 'Canned Responses API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body)).to eq(
expect(response.parsed_body).to eq(
[cr3, cr2, cr1].as_json
)
end

View File

@@ -62,7 +62,7 @@ RSpec.describe 'Api::V1::Accounts::Categories', type: :request do
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['related_categories'][0]['id']).to eql(related_category_1.id)
expect(json_response['payload']['related_categories'][1]['id']).to eql(related_category_2.id)
@@ -107,7 +107,7 @@ RSpec.describe 'Api::V1::Accounts::Categories', type: :request do
params: category_params,
headers: agent.create_new_auth_token
expect(response).to have_http_status(:unprocessable_entity)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['message']).to eql('Locale should be unique in the category and portal')
end
@@ -125,7 +125,7 @@ RSpec.describe 'Api::V1::Accounts::Categories', type: :request do
params: category_params,
headers: agent.create_new_auth_token
expect(response).to have_http_status(:unprocessable_entity)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['message']).to eql("Slug can't be blank")
end
@@ -160,7 +160,7 @@ RSpec.describe 'Api::V1::Accounts::Categories', type: :request do
params: category_params,
headers: agent.create_new_auth_token
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['name']).to eql(category_params[:category][:name])
expect(json_response['payload']['related_categories'][0]['id']).to eql(related_category_1.id)
@@ -185,7 +185,7 @@ RSpec.describe 'Api::V1::Accounts::Categories', type: :request do
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['name']).to eql(category.name)
expect(json_response['payload']['related_categories'][0]['id']).to eql(related_category_1.id)
@@ -257,7 +257,7 @@ RSpec.describe 'Api::V1::Accounts::Categories', type: :request do
get "/api/v1/accounts/#{account.id}/portals/#{portal.slug}/categories",
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload'].count).to be(category_count + 1)
end
end

View File

@@ -4,13 +4,13 @@ RSpec.describe '/api/v1/accounts/{account.id}/channels/twilio_channel', type: :r
let(:account) { create(:account) }
let(:admin) { create(:user, account: account, role: :administrator) }
let(:agent) { create(:user, account: account, role: :agent) }
let(:twilio_client) { instance_double(::Twilio::REST::Client) }
let(:twilio_client) { instance_double(Twilio::REST::Client) }
let(:message_double) { double }
let(:twilio_webhook_setup_service) { instance_double(::Twilio::WebhookSetupService) }
let(:twilio_webhook_setup_service) { instance_double(Twilio::WebhookSetupService) }
before do
allow(::Twilio::REST::Client).to receive(:new).and_return(twilio_client)
allow(::Twilio::WebhookSetupService).to receive(:new).and_return(twilio_webhook_setup_service)
allow(Twilio::REST::Client).to receive(:new).and_return(twilio_client)
allow(Twilio::WebhookSetupService).to receive(:new).and_return(twilio_webhook_setup_service)
allow(twilio_webhook_setup_service).to receive(:perform)
end
@@ -46,7 +46,7 @@ RSpec.describe '/api/v1/accounts/{account.id}/channels/twilio_channel', type: :r
headers: admin.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['name']).to eq('SMS Channel')
expect(json_response['messaging_service_sid']).to eq('MGec8130512b5dd462cfe03095ec1342ed')
@@ -71,7 +71,7 @@ RSpec.describe '/api/v1/accounts/{account.id}/channels/twilio_channel', type: :r
headers: admin.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['messaging_service_sid']).to eq('MGec8130512b5dd462cfe03095ec1111ed')
end
@@ -99,7 +99,7 @@ RSpec.describe '/api/v1/accounts/{account.id}/channels/twilio_channel', type: :r
headers: admin.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['name']).to eq('SMS Channel')
expect(json_response['phone_number']).to eq('+1234567890')
@@ -124,7 +124,7 @@ RSpec.describe '/api/v1/accounts/{account.id}/channels/twilio_channel', type: :r
headers: admin.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['phone_number']).to eq('whatsapp:+1224466880')
end

View File

@@ -33,7 +33,7 @@ RSpec.describe '/api/v1/accounts/{account.id}/contacts/:id/conversations', type:
get "/api/v1/accounts/#{account.id}/contacts/#{contact.id}/conversations", headers: admin.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload'].length).to eq 4
end
@@ -44,7 +44,7 @@ RSpec.describe '/api/v1/accounts/{account.id}/contacts/:id/conversations', type:
get "/api/v1/accounts/#{account.id}/contacts/#{contact.id}/conversations", headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload'].length).to eq 2
end
@@ -55,7 +55,7 @@ RSpec.describe '/api/v1/accounts/{account.id}/contacts/:id/conversations', type:
get "/api/v1/accounts/#{account.id}/contacts/#{contact.id}/conversations", headers: unknown.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload'].length).to eq 0
end

View File

@@ -114,7 +114,7 @@ RSpec.describe 'Notes API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(::Note.exists?(note.id)).to be false
expect(Note.exists?(note.id)).to be false
end
end
end

View File

@@ -35,7 +35,7 @@ RSpec.describe 'Contacts API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['payload'].first['email']).to eq(contact.email)
expect(response_body['payload'].first['contact_inboxes'].first['source_id']).to eq(contact_inbox.source_id)
expect(response_body['payload'].first['contact_inboxes'].first['inbox']['name']).to eq(contact_inbox.inbox.name)
@@ -47,7 +47,7 @@ RSpec.describe 'Contacts API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['payload'].first['email']).to eq(contact.email)
expect(response_body['payload'].first['contact_inboxes'].blank?).to be(true)
end
@@ -58,7 +58,7 @@ RSpec.describe 'Contacts API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['payload'].last['id']).to eq(contact_4.id)
expect(response_body['payload'].last['email']).to eq(contact_4.email)
end
@@ -69,7 +69,7 @@ RSpec.describe 'Contacts API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['payload'].first['email']).to eq(contact_1.email)
expect(response_body['payload'].first['id']).to eq(contact_1.id)
expect(response_body['payload'].last['email']).to eq(contact_4.email)
@@ -81,7 +81,7 @@ RSpec.describe 'Contacts API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['payload'].first['email']).to eq(contact.email)
expect(response_body['payload'].first['id']).to eq(contact.id)
expect(response_body['payload'].last['email']).to eq(contact_4.email)
@@ -94,7 +94,7 @@ RSpec.describe 'Contacts API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['payload'].first['conversations_count']).to eq(contact.conversations.count)
expect(response_body['payload'].first['last_seen_at']).present?
end
@@ -110,7 +110,7 @@ RSpec.describe 'Contacts API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['meta']['count']).to eq(2)
expect(response_body['payload'].pluck('email')).to include(contact_with_label1.email, contact_with_label2.email)
end
@@ -160,7 +160,7 @@ RSpec.describe 'Contacts API', type: :request do
post "/api/v1/accounts/#{account.id}/contacts/import",
headers: admin.create_new_auth_token
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(response).to have_http_status(:unprocessable_entity)
expect(json_response['error']).to eq('File is blank')
@@ -191,7 +191,7 @@ RSpec.describe 'Contacts API', type: :request do
end
it 'returns all contacts who are online' do
allow(::OnlineStatusTracker).to receive(:get_available_contact_ids).and_return([contact.id])
allow(OnlineStatusTracker).to receive(:get_available_contact_ids).and_return([contact.id])
get "/api/v1/accounts/#{account.id}/contacts/active",
headers: admin.create_new_auth_token,
@@ -353,7 +353,7 @@ RSpec.describe 'Contacts API', type: :request do
expect(response).to have_http_status(:success)
# only the inboxes which agent has access to are shown
expect(JSON.parse(response.body)['payload'].pluck('inbox').pluck('id')).to eq([twilio_whatsapp_inbox.id])
expect(response.parsed_body['payload'].pluck('inbox').pluck('id')).to eq([twilio_whatsapp_inbox.id])
end
end
end
@@ -383,7 +383,7 @@ RSpec.describe 'Contacts API', type: :request do
expect(response).to have_http_status(:success)
# custom attributes are updated
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['contact']['custom_attributes']).to eq({ 'test' => 'test', 'test1' => 'test1' })
end
@@ -395,7 +395,7 @@ RSpec.describe 'Contacts API', type: :request do
expect(response).to have_http_status(:unprocessable_entity)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['message']).to eq('Name is too long (maximum is 255 characters)')
end
@@ -460,7 +460,7 @@ RSpec.describe 'Contacts API', type: :request do
as: :json
expect(response).to have_http_status(:unprocessable_entity)
expect(JSON.parse(response.body)['attributes']).to include('email')
expect(response.parsed_body['attributes']).to include('email')
end
it 'prevents updating with an existing phone number' do
@@ -472,7 +472,7 @@ RSpec.describe 'Contacts API', type: :request do
as: :json
expect(response).to have_http_status(:unprocessable_entity)
expect(JSON.parse(response.body)['attributes']).to include('phone_number')
expect(response.parsed_body['attributes']).to include('phone_number')
end
it 'updates avatar' do
@@ -517,7 +517,7 @@ RSpec.describe 'Contacts API', type: :request do
let(:agent) { create(:user, account: account, role: :agent) }
it 'deletes the contact for administrator user' do
allow(::OnlineStatusTracker).to receive(:get_presence).and_return(false)
allow(OnlineStatusTracker).to receive(:get_presence).and_return(false)
delete "/api/v1/accounts/#{account.id}/contacts/#{contact.id}",
headers: admin.create_new_auth_token
@@ -530,7 +530,7 @@ RSpec.describe 'Contacts API', type: :request do
end
it 'does not delete the contact if online' do
allow(::OnlineStatusTracker).to receive(:get_presence).and_return(true)
allow(OnlineStatusTracker).to receive(:get_presence).and_return(true)
delete "/api/v1/accounts/#{account.id}/contacts/#{contact.id}",
headers: admin.create_new_auth_token
@@ -591,7 +591,7 @@ RSpec.describe 'Contacts API', type: :request do
context 'when it is an authenticated user' do
before do
create(:contact, account: account)
contact.avatar.attach(io: File.open(Rails.root.join('spec/assets/avatar.png')), filename: 'avatar.png', content_type: 'image/png')
contact.avatar.attach(io: Rails.root.join('spec/assets/avatar.png').open, filename: 'avatar.png', content_type: 'image/png')
end
it 'delete contact avatar' do

View File

@@ -26,7 +26,7 @@ RSpec.describe '/api/v1/accounts/:account_id/conversations/:conversation_id/dire
as: :json
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['content_type']).to eq('image/png')
end
end

View File

@@ -45,7 +45,7 @@ RSpec.describe 'Conversation Messages API', type: :request do
expect(response).to have_http_status(:unprocessable_entity)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['error']).to eq('Validation failed: Content is too long (maximum is 150000 characters)')
end
@@ -61,7 +61,7 @@ RSpec.describe 'Conversation Messages API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body)
response_data = response.parsed_body
expect(response_data['content_attributes']['external_created_at']).to eq time_stamp
expect(conversation.messages.count).to eq(1)
expect(conversation.messages.last.sender_id).to eq(agent_bot.id)

View File

@@ -765,7 +765,7 @@ RSpec.describe 'Conversations API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['payload'].first['file_type']).to eq('image')
end
@@ -775,7 +775,7 @@ RSpec.describe 'Conversations API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['payload'].length).to eq(1)
end
end

View File

@@ -30,7 +30,7 @@ RSpec.describe 'CSAT Survey Responses API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body).first['feedback_message']).to eq(csat_survey_response.feedback_message)
expect(response.parsed_body.first['feedback_message']).to eq(csat_survey_response.feedback_message)
end
it 'filters csat responses based on a date range' do
@@ -43,7 +43,7 @@ RSpec.describe 'CSAT Survey Responses API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body)
response_data = response.parsed_body
expect(response_data.pluck('id')).to include(csat_3_days_ago.id)
expect(response_data.pluck('id')).not_to include(csat_10_days_ago.id)
end
@@ -63,7 +63,7 @@ RSpec.describe 'CSAT Survey Responses API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body)
response_data = response.parsed_body
expect(response_data.size).to eq 2
end
@@ -104,7 +104,7 @@ RSpec.describe 'CSAT Survey Responses API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body)
response_data = response.parsed_body
expect(response_data['total_count']).to eq 1
expect(response_data['total_sent_messages_count']).to eq 0
expect(response_data['ratings_count']).to eq({ '1' => 1 })
@@ -123,7 +123,7 @@ RSpec.describe 'CSAT Survey Responses API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body)
response_data = response.parsed_body
expect(response_data['total_count']).to eq 1
expect(response_data['total_sent_messages_count']).to eq 0
expect(response_data['ratings_count']).to eq({ '1' => 1 })
@@ -144,7 +144,7 @@ RSpec.describe 'CSAT Survey Responses API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body)
response_data = response.parsed_body
expect(response_data['total_count']).to eq 2
expect(response_data['total_sent_messages_count']).to eq 0
expect(response_data['ratings_count']).to eq({ '1' => 2 })

View File

@@ -23,7 +23,7 @@ RSpec.describe 'Custom Attribute Definitions API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body.count).to eq(2)
expect(response_body.first['attribute_key']).to eq(custom_attribute_definition.attribute_key)
@@ -86,7 +86,7 @@ RSpec.describe 'Custom Attribute Definitions API', type: :request do
end.to change(CustomAttributeDefinition, :count).by(1)
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['attribute_key']).to eq 'developer_id'
end
end

View File

@@ -22,7 +22,7 @@ RSpec.describe 'Custom Filters API', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body.first['name']).to eq(custom_filter.name)
expect(response_body.first['query']).to eq(custom_filter.query)
end
@@ -74,7 +74,7 @@ RSpec.describe 'Custom Filters API', type: :request do
end.to change(CustomFilter, :count).by(1)
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['name']).to eq 'vip-customers'
end
end

View File

@@ -22,7 +22,7 @@ RSpec.describe 'DashboardAppsController', type: :request do
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body.first['title']).to eq(dashboard_app.title)
expect(response_body.first['content']).to eq(dashboard_app.content)
end
@@ -76,7 +76,7 @@ RSpec.describe 'DashboardAppsController', type: :request do
end.to change(DashboardApp, :count).by(1)
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['title']).to eq 'CRM Dashboard'
expect(json_response['content'][0]['link']).to eq payload[:dashboard_app][:content][0][:link]
expect(json_response['content'][0]['type']).to eq payload[:dashboard_app][:content][0][:type]
@@ -89,7 +89,7 @@ RSpec.describe 'DashboardAppsController', type: :request do
end.not_to change(DashboardApp, :count)
expect(response).to have_http_status(:unprocessable_entity)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['message']).to eq 'Content : Invalid data'
end
@@ -126,7 +126,7 @@ RSpec.describe 'DashboardAppsController', type: :request do
as: :json
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(dashboard_app.reload.title).to eq('CRM Dashboard')
expect(json_response['content'][0]['link']).to eq payload[:dashboard_app][:content][0][:link]
expect(json_response['content'][0]['type']).to eq payload[:dashboard_app][:content][0][:type]

View File

@@ -38,7 +38,7 @@ RSpec.describe 'Inbox Member API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body)['payload'].pluck('id')).to eq(inbox.inbox_members.pluck(:user_id))
expect(response.parsed_body['payload'].pluck('id')).to eq(inbox.inbox_members.pluck(:user_id))
end
end
end

View File

@@ -248,7 +248,7 @@ RSpec.describe 'Inboxes API', type: :request do
context 'when it is an authenticated user' do
before do
create(:inbox_member, user: agent, inbox: inbox)
inbox.avatar.attach(io: File.open(Rails.root.join('spec/assets/avatar.png')), filename: 'avatar.png', content_type: 'image/png')
inbox.avatar.attach(io: Rails.root.join('spec/assets/avatar.png').open, filename: 'avatar.png', content_type: 'image/png')
end
it 'delete inbox avatar for administrator user' do
@@ -293,7 +293,7 @@ RSpec.describe 'Inboxes API', type: :request do
as: :json
end
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(response).to have_http_status(:success)
expect(json_response['message']).to eq('Your inbox deletion request will be processed in some time.')
@@ -410,7 +410,7 @@ RSpec.describe 'Inboxes API', type: :request do
as: :json
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['allow_messages_after_resolved']).to be true
end
end
@@ -452,7 +452,7 @@ RSpec.describe 'Inboxes API', type: :request do
expect(response).to have_http_status(:success)
expect(inbox.reload.enable_auto_assignment).to be_falsey
expect(inbox.reload.portal_id).to eq(portal.id)
expect(JSON.parse(response.body)['name']).to eq 'new test inbox'
expect(response.parsed_body['name']).to eq 'new test inbox'
end
it 'updates api inbox when administrator' do

View File

@@ -22,7 +22,7 @@ RSpec.describe 'Integration Apps API', type: :request do
as: :json
expect(response).to have_http_status(:success)
apps = JSON.parse(response.body)['payload'].first
apps = response.parsed_body['payload'].first
expect(apps['id']).to eql(first_app.id)
expect(apps['name']).to eql(first_app.name)
expect(apps['action']).to be_nil
@@ -36,7 +36,7 @@ RSpec.describe 'Integration Apps API', type: :request do
expect(response).to have_http_status(:success)
app = JSON.parse(response.body)['payload'].find { |int_app| int_app['id'] == openai.app.id }
app = response.parsed_body['payload'].find { |int_app| int_app['id'] == openai.app.id }
expect(app['hooks'].first['settings']).to be_nil
end
@@ -47,7 +47,7 @@ RSpec.describe 'Integration Apps API', type: :request do
as: :json
expect(response).to have_http_status(:success)
apps = JSON.parse(response.body)['payload'].first
apps = response.parsed_body['payload'].first
expect(apps['id']).to eql(first_app.id)
expect(apps['name']).to eql(first_app.name)
expect(apps['action']).to eql(first_app.action)
@@ -60,7 +60,7 @@ RSpec.describe 'Integration Apps API', type: :request do
as: :json
expect(response).to have_http_status(:success)
apps = JSON.parse(response.body)['payload']
apps = response.parsed_body['payload']
slack_app = apps.find { |app| app['id'] == 'slack' }
expect(slack_app['action']).to include('client_id=client_id')
end
@@ -74,7 +74,7 @@ RSpec.describe 'Integration Apps API', type: :request do
expect(response).to have_http_status(:success)
app = JSON.parse(response.body)['payload'].find { |int_app| int_app['id'] == openai.app.id }
app = response.parsed_body['payload'].find { |int_app| int_app['id'] == openai.app.id }
expect(app['hooks'].first['settings']).not_to be_nil
end
end
@@ -98,7 +98,7 @@ RSpec.describe 'Integration Apps API', type: :request do
as: :json
expect(response).to have_http_status(:success)
app = JSON.parse(response.body)
app = response.parsed_body
expect(app['id']).to eql('slack')
expect(app['name']).to eql('Slack')
end
@@ -111,7 +111,7 @@ RSpec.describe 'Integration Apps API', type: :request do
expect(response).to have_http_status(:success)
app = JSON.parse(response.body)
app = response.parsed_body
expect(app['hooks'].first['settings']).to be_nil
end
@@ -123,7 +123,7 @@ RSpec.describe 'Integration Apps API', type: :request do
expect(response).to have_http_status(:success)
app = JSON.parse(response.body)
app = response.parsed_body
expect(app['hooks'].first['settings']).not_to be_nil
end
end

View File

@@ -53,7 +53,7 @@ RSpec.describe 'Dyte Integration API', type: :request do
headers: agent.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
last_message = conversation.reload.messages.last
expect(conversation.display_id).to eq(response_body['conversation_id'])
expect(last_message.id).to eq(response_body['id'])
@@ -76,7 +76,7 @@ RSpec.describe 'Dyte Integration API', type: :request do
headers: agent.create_new_auth_token,
as: :json
expect(response).to have_http_status(:unprocessable_entity)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['error']).to eq({ 'data' => { 'message' => 'Title is required' }, 'success' => false })
end
end
@@ -126,7 +126,7 @@ RSpec.describe 'Dyte Integration API', type: :request do
headers: agent.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
response_body = JSON.parse(response.body)
response_body = response.parsed_body
expect(response_body['authResponse']).to eq(
{
'userAdded' => true, 'id' => 'random_uuid', 'auth_token' => 'json-web-token'

View File

@@ -35,7 +35,7 @@ RSpec.describe 'Integration Hooks API', type: :request do
as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['app_id']).to eq params[:app_id]
end
end
@@ -71,7 +71,7 @@ RSpec.describe 'Integration Hooks API', type: :request do
as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['app_id']).to eq 'slack'
end
end
@@ -131,7 +131,7 @@ RSpec.describe 'Integration Hooks API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(::Integrations::Hook.exists?(hook.id)).to be false
expect(Integrations::Hook.exists?(hook.id)).to be false
end
end
end

View File

@@ -26,7 +26,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
visible_macros = account.macros.global.or(account.macros.personal.where(created_by_id: administrator.id)).order(:id)
expect(response).to have_http_status(:success)
body = JSON.parse(response.body)
body = response.parsed_body
expect(body['payload'].length).to eq(visible_macros.count)
@@ -42,7 +42,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
expect(response).to have_http_status(:success)
body = JSON.parse(response.body)
body = response.parsed_body
visible_macros = account.macros.global.or(account.macros.personal.where(created_by_id: agent.id)).order(:id)
expect(body['payload'].length).to eq(visible_macros.count)
@@ -105,7 +105,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['name']).to eql(params['name'])
expect(json_response['payload']['visibility']).to eql(params['visibility'])
@@ -119,7 +119,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['name']).to eql(params['name'])
expect(json_response['payload']['visibility']).to eql('personal')
@@ -135,7 +135,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
expect(response).to have_http_status(:success)
blob = JSON.parse(response.body)
blob = response.parsed_body
expect(blob['blob_key']).to be_present
expect(blob['blob_id']).to be_present
@@ -186,7 +186,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
headers: administrator.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['name']).to eql(params['name'])
end
@@ -197,7 +197,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
params: params,
headers: agent_1.create_new_auth_token
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(response).to have_http_status(:unauthorized)
expect(json_response['error']).to eq('You are not authorized to do this action')
@@ -223,7 +223,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload']['name']).to eql(macro.name)
expect(json_response['payload']['created_by']['id']).to eql(administrator.id)
@@ -242,7 +242,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
get "/api/v1/accounts/#{account.id}/macros/#{macro.id}",
headers: agent_1.create_new_auth_token
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(response).to have_http_status(:unauthorized)
expect(json_response['error']).to eq('You are not authorized to do this action')
@@ -452,7 +452,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
delete "/api/v1/accounts/#{account.id}/macros/#{macro.id}",
headers: agent_1.create_new_auth_token
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(response).to have_http_status(:unauthorized)
expect(json_response['error']).to eq('You are not authorized to do this action')
@@ -464,7 +464,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
delete "/api/v1/accounts/#{account.id}/macros/#{macro.id}",
headers: agent_1.create_new_auth_token
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(response).to have_http_status(:unauthorized)
expect(json_response['error']).to eq('You are not authorized to do this action')

View File

@@ -40,8 +40,8 @@ RSpec.describe 'Microsoft Authorization API', type: :request do
prompt: 'consent'
}
)
expect(JSON.parse(response.body)['url']).to eq response_url
expect(::Redis::Alfred.get(administrator.email)).to eq(account.id.to_s)
expect(response.parsed_body['url']).to eq response_url
expect(Redis::Alfred.get(administrator.email)).to eq(account.id.to_s)
end
end
end

View File

@@ -21,7 +21,7 @@ RSpec.describe 'Notification Settings API', type: :request do
as: :json
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['user_id']).to eq(agent.id)
expect(json_response['account_id']).to eq(account.id)
end
@@ -47,7 +47,7 @@ RSpec.describe 'Notification Settings API', type: :request do
as: :json
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
agent.reload
expect(json_response['user_id']).to eq(agent.id)
expect(json_response['account_id']).to eq(account.id)

View File

@@ -22,7 +22,7 @@ RSpec.describe 'Notifications API', type: :request do
headers: admin.create_new_auth_token,
as: :json
response_json = JSON.parse(response.body)
response_json = response.parsed_body
expect(response).to have_http_status(:success)
expect(response.body).to include(notification1.notification_type)
expect(response_json['data']['meta']['unread_count']).to eq 2
@@ -121,7 +121,7 @@ RSpec.describe 'Notifications API', type: :request do
headers: admin.create_new_auth_token,
as: :json
response_json = JSON.parse(response.body)
response_json = response.parsed_body
expect(response).to have_http_status(:success)
expect(response_json).to eq 2
end

View File

@@ -26,7 +26,7 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['payload'].length).to be 2
expect(json_response['payload'][0]['id']).to be portal.id
end
@@ -48,7 +48,7 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['name']).to eq portal.name
expect(json_response['meta']['all_articles_count']).to eq 0
end
@@ -65,7 +65,7 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do
headers: agent.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['name']).to eq portal.name
expect(json_response['meta']['all_articles_count']).to eq 2
expect(json_response['meta']['mine_articles_count']).to eq 1
@@ -98,7 +98,7 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do
headers: admin.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['name']).to eql('test_portal')
expect(json_response['custom_domain']).to eql('support.chatwoot.dev')
end
@@ -130,7 +130,7 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do
headers: admin.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['name']).to eql(portal_params[:portal][:name])
expect(json_response['config']).to eql({ 'allowed_locales' => [{ 'articles_count' => 0, 'categories_count' => 0, 'code' => 'en' },
{ 'articles_count' => 0, 'categories_count' => 0, 'code' => 'es' }] })
@@ -150,7 +150,7 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do
headers: admin.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['archived']).to eql(portal_params[:portal][:archived])
portal.reload
@@ -204,7 +204,7 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do
headers: admin.create_new_auth_token
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(portal.reload.member_ids).to include(agent_1.id)
expect(json_response['portal_members'].length).to be(3)
end
@@ -221,7 +221,7 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do
expect(response).to have_http_status(:success)
blob = JSON.parse(response.body)
blob = response.parsed_body
expect(blob['blob_key']).to be_present
expect(blob['blob_id']).to be_present

View File

@@ -33,7 +33,7 @@ RSpec.describe 'Search', type: :request do
response_data = JSON.parse(response.body, symbolize_names: true)
expect(response_data[:payload][:messages].first[:content]).to eq 'test2'
expect(response_data[:payload].keys).to match_array [:contacts, :conversations, :messages]
expect(response_data[:payload].keys).to contain_exactly(:contacts, :conversations, :messages)
expect(response_data[:payload][:messages].length).to eq 2
expect(response_data[:payload][:conversations].length).to eq 1
expect(response_data[:payload][:contacts].length).to eq 1
@@ -60,7 +60,7 @@ RSpec.describe 'Search', type: :request do
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body, symbolize_names: true)
expect(response_data[:payload].keys).to match_array [:contacts]
expect(response_data[:payload].keys).to contain_exactly(:contacts)
expect(response_data[:payload][:contacts].length).to eq 1
end
end
@@ -85,7 +85,7 @@ RSpec.describe 'Search', type: :request do
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body, symbolize_names: true)
expect(response_data[:payload].keys).to match_array [:conversations]
expect(response_data[:payload].keys).to contain_exactly(:conversations)
expect(response_data[:payload][:conversations].length).to eq 1
end
end
@@ -110,7 +110,7 @@ RSpec.describe 'Search', type: :request do
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body, symbolize_names: true)
expect(response_data[:payload].keys).to match_array [:messages]
expect(response_data[:payload].keys).to contain_exactly(:messages)
expect(response_data[:payload][:messages].length).to eq 2
end
end

View File

@@ -24,7 +24,7 @@ RSpec.describe 'Team Members API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body).first['id']).to eq(agent.id)
expect(response.parsed_body.first['id']).to eq(agent.id)
end
end
end
@@ -65,7 +65,7 @@ RSpec.describe 'Team Members API', type: :request do
as: :json
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response.count).to eq(user_ids.count - 1)
end
end
@@ -144,7 +144,7 @@ RSpec.describe 'Team Members API', type: :request do
as: :json
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response.count).to eq(user_ids.count)
end
@@ -157,7 +157,7 @@ RSpec.describe 'Team Members API', type: :request do
as: :json
expect(response).to have_http_status(:unauthorized)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['error']).to eq('Invalid User IDs')
end
end

View File

@@ -22,7 +22,7 @@ RSpec.describe 'Teams API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body).first['id']).to eq(account.teams.first.id)
expect(response.parsed_body.first['id']).to eq(account.teams.first.id)
end
end
end
@@ -45,7 +45,7 @@ RSpec.describe 'Teams API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body)['id']).to eq(team.id)
expect(response.parsed_body['id']).to eq(team.id)
end
end
end

View File

@@ -39,7 +39,7 @@ RSpec.describe 'Twitter Authorization API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body)['url']).to include('test_token')
expect(response.parsed_body['url']).to include('test_token')
end
end
end

View File

@@ -23,7 +23,7 @@ RSpec.describe 'Webhooks API', type: :request do
headers: administrator.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body)['payload']['webhooks'].count).to eql account.webhooks.count
expect(response.parsed_body['payload']['webhooks'].count).to eql account.webhooks.count
end
end
end
@@ -46,7 +46,7 @@ RSpec.describe 'Webhooks API', type: :request do
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body)['payload']['webhook']['url']).to eql 'https://hello.com'
expect(response.parsed_body['payload']['webhook']['url']).to eql 'https://hello.com'
end
it 'throws error when invalid url provided' do
@@ -55,7 +55,7 @@ RSpec.describe 'Webhooks API', type: :request do
headers: administrator.create_new_auth_token,
as: :json
expect(response).to have_http_status(:unprocessable_entity)
expect(JSON.parse(response.body)['message']).to eql 'Url is invalid'
expect(response.parsed_body['message']).to eql 'Url is invalid'
end
it 'throws error if subscription events are invalid' do
@@ -64,7 +64,7 @@ RSpec.describe 'Webhooks API', type: :request do
headers: administrator.create_new_auth_token,
as: :json
expect(response).to have_http_status(:unprocessable_entity)
expect(JSON.parse(response.body)['message']).to eql 'Subscriptions Invalid events'
expect(response.parsed_body['message']).to eql 'Subscriptions Invalid events'
end
it 'throws error if subscription events are empty' do
@@ -73,7 +73,7 @@ RSpec.describe 'Webhooks API', type: :request do
headers: administrator.create_new_auth_token,
as: :json
expect(response).to have_http_status(:unprocessable_entity)
expect(JSON.parse(response.body)['message']).to eql 'Subscriptions Invalid events'
expect(response.parsed_body['message']).to eql 'Subscriptions Invalid events'
end
it 'use default if subscription events are nil' do
@@ -83,7 +83,7 @@ RSpec.describe 'Webhooks API', type: :request do
as: :json
expect(response).to have_http_status(:ok)
expect(
JSON.parse(response.body)['payload']['webhook']['subscriptions']
response.parsed_body['payload']['webhook']['subscriptions']
).to eql %w[conversation_status_changed conversation_updated conversation_created contact_created contact_updated
message_created message_updated webwidget_triggered]
end
@@ -107,7 +107,7 @@ RSpec.describe 'Webhooks API', type: :request do
headers: administrator.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
expect(JSON.parse(response.body)['payload']['webhook']['url']).to eql 'https://hello.com'
expect(response.parsed_body['payload']['webhook']['url']).to eql 'https://hello.com'
end
end
end