Fix specs

This commit is contained in:
Eugene Burmakin 2025-12-06 12:13:22 +01:00
parent 388e49bba9
commit fafa152b58
5 changed files with 82 additions and 24 deletions

View file

@ -14,7 +14,7 @@ class Api::V1::SettingsController < ApiController
settings_params.each { |key, value| current_api_user.settings[key] = value }
if current_api_user.save
render json: { message: 'Settings updated', settings: current_api_user.settings, status: 'success' },
render json: { message: 'Settings updated', settings: current_api_user.safe_settings.config, status: 'success' },
status: :ok
else
render json: { message: 'Something went wrong', errors: current_api_user.errors.full_messages },

View file

@ -12,6 +12,7 @@ RSpec.describe Api::PointSerializer do
point.attributes.except(*all_excluded).tap do |attributes|
attributes['latitude'] = point.lat.to_s
attributes['longitude'] = point.lon.to_s
attributes['country_name'] = point.country_name
end
end

View file

@ -100,7 +100,7 @@ RSpec.describe Users::ExportData, type: :service do
expect(Users::ExportData::Trips).to receive(:new).with(user)
expect(Users::ExportData::Stats).to receive(:new).with(user)
expect(Users::ExportData::Notifications).to receive(:new).with(user)
expect(Users::ExportData::Points).to receive(:new).with(user)
expect(Users::ExportData::Points).to receive(:new).with(user, an_instance_of(StringIO))
expect(Users::ExportData::Visits).to receive(:new).with(user)
expect(Users::ExportData::Places).to receive(:new).with(user)

View file

@ -137,27 +137,42 @@ describe 'Settings API', type: :request do
description: 'Route opacity percentage (0-100)'
},
meters_between_routes: {
type: :number,
oneOf: [
{ type: :number },
{ type: :string }
],
example: 500,
description: 'Minimum distance between routes in meters'
},
minutes_between_routes: {
type: :number,
oneOf: [
{ type: :number },
{ type: :string }
],
example: 30,
description: 'Minimum time between routes in minutes'
},
fog_of_war_meters: {
type: :number,
oneOf: [
{ type: :number },
{ type: :string }
],
example: 50,
description: 'Fog of war radius in meters'
},
time_threshold_minutes: {
type: :number,
oneOf: [
{ type: :number },
{ type: :string }
],
example: 30,
description: 'Time threshold for grouping points in minutes'
},
merge_threshold_minutes: {
type: :number,
oneOf: [
{ type: :number },
{ type: :string }
],
example: 15,
description: 'Threshold for merging nearby points in minutes'
},
@ -182,32 +197,51 @@ describe 'Settings API', type: :request do
description: 'Whether live map updates are enabled'
},
immich_url: {
type: :string,
oneOf: [
{ type: :string },
{ type: :null }
],
example: 'https://immich.example.com',
description: 'Immich server URL for photo integration'
},
immich_api_key: {
type: :string,
oneOf: [
{ type: :string },
{ type: :null }
],
example: 'your-immich-api-key',
description: 'API key for Immich photo service'
},
photoprism_url: {
type: :string,
oneOf: [
{ type: :string },
{ type: :null }
],
example: 'https://photoprism.example.com',
description: 'PhotoPrism server URL for photo integration'
},
photoprism_api_key: {
type: :string,
oneOf: [
{ type: :string },
{ type: :null }
],
example: 'your-photoprism-api-key',
description: 'API key for PhotoPrism photo service'
},
speed_color_scale: {
type: :string,
oneOf: [
{ type: :string },
{ type: :null }
],
example: 'viridis',
description: 'Color scale for speed-colored routes'
},
fog_of_war_threshold: {
type: :number,
oneOf: [
{ type: :number },
{ type: :string },
{ type: :null }
],
example: 100,
description: 'Fog of war threshold value'
}

View file

@ -1456,23 +1456,33 @@ paths:
example: 60
description: Route opacity percentage (0-100)
meters_between_routes:
type: number
oneOf:
- type: number
- type: string
example: 500
description: Minimum distance between routes in meters
minutes_between_routes:
type: number
oneOf:
- type: number
- type: string
example: 30
description: Minimum time between routes in minutes
fog_of_war_meters:
type: number
oneOf:
- type: number
- type: string
example: 50
description: Fog of war radius in meters
time_threshold_minutes:
type: number
oneOf:
- type: number
- type: string
example: 30
description: Time threshold for grouping points in minutes
merge_threshold_minutes:
type: number
oneOf:
- type: number
- type: string
example: 15
description: Threshold for merging nearby points in minutes
preferred_map_layer:
@ -1493,27 +1503,40 @@ paths:
example: true
description: Whether live map updates are enabled
immich_url:
type: string
oneOf:
- type: string
- type: 'null'
example: https://immich.example.com
description: Immich server URL for photo integration
immich_api_key:
type: string
oneOf:
- type: string
- type: 'null'
example: your-immich-api-key
description: API key for Immich photo service
photoprism_url:
type: string
oneOf:
- type: string
- type: 'null'
example: https://photoprism.example.com
description: PhotoPrism server URL for photo integration
photoprism_api_key:
type: string
oneOf:
- type: string
- type: 'null'
example: your-photoprism-api-key
description: API key for PhotoPrism photo service
speed_color_scale:
type: string
oneOf:
- type: string
- type: 'null'
example: viridis
description: Color scale for speed-colored routes
fog_of_war_threshold:
type: number
oneOf:
- type: number
- type: string
- type: 'null'
example: 100
description: Fog of war threshold value
"/api/v1/stats":