Add and apply RSpec/ReceiveMessages rubocop rule

This rule was added in rubocop-rspec 2.23.0. I didn't know this method
existed, and it makes the code more readable in some cases.
This commit is contained in:
Javi Martín
2023-09-08 13:26:15 +02:00
parent 9bb2bfdd06
commit 1d5f03be8c
10 changed files with 30 additions and 39 deletions

View File

@@ -153,12 +153,9 @@ RSpec.configure do |config|
config.before(:each, :application_zone_west_of_system_zone) do
application_zone = ActiveSupport::TimeZone.new("Quito")
system_zone = ActiveSupport::TimeZone.new("Madrid")
allow(Time).to receive(:zone).and_return(application_zone)
system_time_at_application_end_of_day = Date.current.end_of_day.in_time_zone(system_zone)
allow(Time).to receive(:now).and_return(system_time_at_application_end_of_day)
allow(Time).to receive_messages(zone: application_zone, now: system_time_at_application_end_of_day)
allow(Date).to receive(:today).and_return(system_time_at_application_end_of_day.to_date)
end