Use fixed time for start_at and end_at in suggest_spec.rb

This commit is contained in:
Eugene Burmakin
2024-10-19 23:03:35 +02:00
parent 5accd16deb
commit 60d2ee1cec
4 changed files with 13 additions and 9 deletions

View File

@@ -1 +1 @@
0.15.6
0.15.7

View File

@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
# 0.15.7 - 2024-10-19
### Fixed
- A bug where "RuntimeError: failed to get urandom" was being raised upon importing attempt on Synology.
# 0.15.6 - 2024-10-19
### Fixed

View File

@@ -1,17 +1,15 @@
# -*- coding: us-ascii -*-
# frozen_string_literal: true
# This code fixes failed to get urandom for running Ruby on Docker for Synology.
class Random
class << self
private
# :stopdoc:
# Implementation using OpenSSL
def gen_random_openssl(n)
return OpenSSL::Random.random_bytes(n)
OpenSSL::Random.random_bytes(n)
end
begin
@@ -21,7 +19,7 @@ class Random
begin
require 'openssl'
rescue NoMethodError
raise NotImplementedError, "No random device"
raise NotImplementedError, 'No random device'
else
alias urandom gen_random_openssl
end

View File

@@ -5,8 +5,8 @@ require 'rails_helper'
RSpec.describe Visits::Suggest do
describe '#call' do
let!(:user) { create(:user) }
let(:start_at) { 1.week.ago }
let(:end_at) { Time.current }
let(:start_at) { Time.new(2020, 1, 1, 0, 0, 0) }
let(:end_at) { Time.new(2020, 1, 1, 2, 0, 0) }
let!(:points) do
[