Fix failing specs

This commit is contained in:
Eugene Burmakin
2025-09-13 17:46:45 +02:00
parent 1394d6202c
commit 0ed71c3cc6
5 changed files with 20 additions and 17 deletions

View File

@@ -84,8 +84,8 @@ class Api::V1::Maps::HexagonsController < ApiController
end
@target_user = @stat.user
@start_date = Date.new(@stat.year, @stat.month, 1).beginning_of_day
@end_date = @start_date.end_of_month.end_of_day
@start_date = Date.new(@stat.year, @stat.month, 1).beginning_of_day.iso8601
@end_date = Date.new(@stat.year, @stat.month, 1).end_of_month.end_of_day.iso8601
end
def set_authenticated_context

View File

@@ -116,16 +116,16 @@ class Maps::HexagonGrid
end
{
type: 'FeatureCollection',
features: hexagons,
metadata: {
bbox: [min_lon, min_lat, max_lon, max_lat],
area_km2: area_km2.round(2),
hex_size_m: hex_size,
count: hexagons.count,
total_points: total_points,
user_id: user_id,
date_range: build_date_range_metadata
'type' => 'FeatureCollection',
'features' => hexagons,
'metadata' => {
'bbox' => [min_lon, min_lat, max_lon, max_lat],
'area_km2' => area_km2.round(2),
'hex_size_m' => hex_size,
'count' => hexagons.count,
'total_points' => total_points,
'user_id' => user_id,
'date_range' => build_date_range_metadata
}
}
end
@@ -133,7 +133,7 @@ class Maps::HexagonGrid
def build_date_range_metadata
return nil unless start_date || end_date
{ start_date:, end_date: }
{ 'start_date' => start_date, 'end_date' => end_date }
end
def validate!

View File

@@ -4,8 +4,8 @@ class DeviseCreateUsers < ActiveRecord::Migration[7.0]
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
t.string :email, null: false, default: ''
t.string :encrypted_password, null: false, default: ''
## Recoverable
t.string :reset_password_token
@@ -32,7 +32,6 @@ class DeviseCreateUsers < ActiveRecord::Migration[7.0]
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps null: false
end

View File

@@ -15,7 +15,7 @@ RSpec.describe '/settings/users', type: :request do
it 'redirects to sign in page' do
post settings_users_url, params: { user: valid_attributes }
expect(response).to redirect_to(root_url)
expect(response).to redirect_to(new_user_session_path)
end
end

View File

@@ -12,6 +12,10 @@ RSpec.describe Cache::Clean do
let(:user_2_years_tracked_key) { "dawarich/user_#{user2.id}_years_tracked" }
let(:user_1_points_geocoded_stats_key) { "dawarich/user_#{user1.id}_points_geocoded_stats" }
let(:user_2_points_geocoded_stats_key) { "dawarich/user_#{user2.id}_points_geocoded_stats" }
let(:user_1_countries_key) { "dawarich/user_#{user1.id}_countries" }
let(:user_2_countries_key) { "dawarich/user_#{user2.id}_countries" }
let(:user_1_cities_key) { "dawarich/user_#{user1.id}_cities" }
let(:user_2_cities_key) { "dawarich/user_#{user2.id}_cities" }
before do
# Set up cache entries that should be cleaned