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

@@ -47,7 +47,7 @@ RSpec.describe 'Platform Account Users API', type: :request do
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['user_id']).to eq(user.id)
end
@@ -60,7 +60,7 @@ RSpec.describe 'Platform Account Users API', type: :request do
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['role']).to eq('administrator')
end
end

View File

@@ -39,7 +39,7 @@ RSpec.describe 'Platform Accounts API', type: :request do
expect(response).to have_http_status(:success)
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['name']).to eq('Test Account')
expect(json_response['locale']).to eq('es')
expect(json_response['features']['agent_management']).to be(true)
@@ -59,7 +59,7 @@ RSpec.describe 'Platform Accounts API', type: :request do
disable_branding: false
} }, headers: { api_access_token: platform_app.access_token.token }, as: :json
json_response = JSON.parse(response.body)
json_response = response.parsed_body
expect(json_response['name']).to include('Test Account')
expect(json_response['features']['inbox_management']).to be(true)
expect(json_response['features']['ip_lookup']).to be(true)

View File

@@ -24,7 +24,7 @@ RSpec.describe 'Platform Agent Bot API', type: :request do
it 'returns unauthorized when its not a permissible object' do
get '/platform/api/v1/agent_bots', headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data.length).to eq(0)
end
@@ -35,7 +35,7 @@ RSpec.describe 'Platform Agent Bot API', type: :request do
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data.length).to eq(1)
end
end
@@ -71,7 +71,7 @@ RSpec.describe 'Platform Agent Bot API', type: :request do
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['name']).to eq(agent_bot.name)
end
end
@@ -100,7 +100,7 @@ RSpec.describe 'Platform Agent Bot API', type: :request do
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['name']).to eq('test')
expect(platform_app.platform_app_permissibles.first.permissible_id).to eq data['id']
end
@@ -137,7 +137,7 @@ RSpec.describe 'Platform Agent Bot API', type: :request do
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['name']).to eq('test123')
end
end

View File

@@ -33,7 +33,7 @@ RSpec.describe 'Platform Users API', type: :request do
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['email']).to eq(user.email)
expect(data['custom_attributes']['test']).to eq('test')
end
@@ -70,7 +70,7 @@ RSpec.describe 'Platform Users API', type: :request do
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['url']).to include('email=dev%2Btesting%40chatwoot.com&sso_auth_token=')
end
end
@@ -103,7 +103,7 @@ RSpec.describe 'Platform Users API', type: :request do
end.not_to enqueue_mail
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data).to match(
hash_including(
'name' => 'test',
@@ -118,7 +118,7 @@ RSpec.describe 'Platform Users API', type: :request do
post '/platform/api/v1/users/', params: { name: 'test', email: 'TesT@test.com', password: 'Password1!' },
headers: { api_access_token: platform_app.access_token.token }, as: :json
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['message']).to eq('Email has already been taken')
end
@@ -128,7 +128,7 @@ RSpec.describe 'Platform Users API', type: :request do
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['name']).to eq('old test')
expect(platform_app.platform_app_permissibles.first.permissible_id).to eq data['id']
end
@@ -167,7 +167,7 @@ RSpec.describe 'Platform Users API', type: :request do
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)
data = response.parsed_body
expect(data['name']).to eq('test123')
expect(data['email']).to eq('newtestemail@test.com')
expect(data['custom_attributes']['test']).to eq('test_update')