Skip to content

Commit

Permalink
Use fixed time for start_at and end_at in suggest_spec.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
Freika committed Oct 19, 2024
1 parent 5accd16 commit 60d2ee1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .app_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.15.6
0.15.7
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions config/initializers/00_random.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -21,7 +19,7 @@ def gen_random_openssl(n)
begin
require 'openssl'
rescue NoMethodError
raise NotImplementedError, "No random device"
raise NotImplementedError, 'No random device'
else
alias urandom gen_random_openssl
end
Expand Down
4 changes: 2 additions & 2 deletions spec/services/visits/suggest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
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
[
Expand Down

0 comments on commit 60d2ee1

Please sign in to comment.