OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
rubocop
Ivan Kuchinb30fd5b04a12
diff --git a/spec/workers/notifications/schedule_date_alerts_notifications_job_spec.rb b/spec/workers/notifications/schedule_date_alerts_notifications_job_spec.rbindex 287f3df4aba..6475236eb04 100644--- a/spec/workers/notifications/schedule_date_alerts_notifications_job_spec.rb+++ b/spec/workers/notifications/schedule_date_alerts_notifications_job_spec.rb@@ -26,24 +26,24 @@# See docs/COPYRIGHT.rdoc for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe Notifications::ScheduleDateAlertsNotificationsJob, type: :job, with_ee: %i[date_alerts] doinclude ActiveSupport::Testing::TimeHelpers- shared_let(:project) { create(:project, name: 'main') }+ shared_let(:project) { create(:project, name: "main") }# Paris and Berlin are both UTC+01:00 (CET) or UTC+02:00 (CEST)- shared_let(:timezone_paris) { ActiveSupport::TimeZone['Europe/Paris'] }+ shared_let(:timezone_paris) { ActiveSupport::TimeZone["Europe/Paris"] }# Kathmandu is UTC+05:45 (no DST)- shared_let(:timezone_kathmandu) { ActiveSupport::TimeZone['Asia/Kathmandu'] }+ shared_let(:timezone_kathmandu) { ActiveSupport::TimeZone["Asia/Kathmandu"] }shared_let(:user_paris) docreate(:user,- firstname: 'Paris',+ firstname: "Paris",preferences: { time_zone: timezone_paris.name })endshared_let(:user_kathmandu) docreate(:user,- firstname: 'Kathmandu',+ firstname: "Kathmandu",preferences: { time_zone: timezone_kathmandu.name })end@@ -60,7 +60,7 @@ RSpec.describe Notifications::ScheduleDateAlertsNotificationsJob, type: :job, wi# Converts "hh:mm" into { hour: h, min: m }def time_hash(time)- %i[hour min].zip(time.split(':', 2).map(&:to_i)).to_h+ %i[hour min].zip(time.split(":", 2).map(&:to_i)).to_henddef timezone_time(time, timezone)@@ -86,13 +86,13 @@ RSpec.describe Notifications::ScheduleDateAlertsNotificationsJob, type: :job, widef expect_job(job, *arguments)job_data = deserialize_job(job)- expect(job_data['job_class']).to eql(job.job_class)- expect(job_data['arguments']).to match_array arguments- expect(job_data['executions']).to eq 0+ expect(job_data["job_class"]).to eql(job.job_class)+ expect(job_data["arguments"]).to match_array arguments+ expect(job_data["executions"]).to eq 0end- shared_examples_for 'job execution creates date alerts creation job' do- it 'creates the job for the user' do+ shared_examples_for "job execution creates date alerts creation job" do+ it "creates the job for the user" doexpect dorun_job(timezone:, scheduled_at:, local_time:) doj = GoodJob::Job.where(job_class: "Notifications::CreateDateAlertsNotificationsJob")@@ -104,77 +104,77 @@ RSpec.describe Notifications::ScheduleDateAlertsNotificationsJob, type: :job, wiendend- shared_examples_for 'job execution creates no date alerts creation job' do- it 'creates no job' do+ shared_examples_for "job execution creates no date alerts creation job" do+ it "creates no job" doexpect dorun_job(timezone:, scheduled_at:, local_time:)end.not_to change(GoodJob::Job, :count)endend- describe '#perform' do- context 'for users whose local time is 1:00 am (UTC+1) when the job is executed' do- it_behaves_like 'job execution creates date alerts creation job' do+ describe "#perform" do+ context "for users whose local time is 1:00 am (UTC+1) when the job is executed" do+ it_behaves_like "job execution creates date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:04' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:04" }let(:user) { user_paris }endend- context 'for users whose local time is 1:00 am (UTC+05:45) when the job is executed' do- it_behaves_like 'job execution creates date alerts creation job' do+ context "for users whose local time is 1:00 am (UTC+05:45) when the job is executed" do+ it_behaves_like "job execution creates date alerts creation job" dolet(:timezone) { timezone_kathmandu }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:04' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:04" }let(:user) { user_kathmandu }endend- context 'without enterprise token', with_ee: false do- it_behaves_like 'job execution creates no date alerts creation job' do+ context "without enterprise token", with_ee: false do+ it_behaves_like "job execution creates no date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:04' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:04" }endend- context 'when scheduled and executed at 01:00 am local time' do- it_behaves_like 'job execution creates date alerts creation job' do+ context "when scheduled and executed at 01:00 am local time" do+ it_behaves_like "job execution creates date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:00' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:00" }let(:user) { user_paris }endend- context 'when scheduled and executed at 01:14 am local time' do- it_behaves_like 'job execution creates date alerts creation job' do+ context "when scheduled and executed at 01:14 am local time" do+ it_behaves_like "job execution creates date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:14' }- let(:local_time) { '1:14' }+ let(:scheduled_at) { "1:14" }+ let(:local_time) { "1:14" }let(:user) { user_paris }endend- context 'when scheduled and executed at 01:15 am local time' do- it_behaves_like 'job execution creates no date alerts creation job' do+ context "when scheduled and executed at 01:15 am local time" do+ it_behaves_like "job execution creates no date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:15' }- let(:local_time) { '1:15' }+ let(:scheduled_at) { "1:15" }+ let(:local_time) { "1:15" }endend- context 'when scheduled at 01:00 am local time and executed at 01:37 am local time' do- it_behaves_like 'job execution creates date alerts creation job' do+ context "when scheduled at 01:00 am local time and executed at 01:37 am local time" do+ it_behaves_like "job execution creates date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:37' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:37" }let(:user) { user_paris }endend- context 'with a user having only due_date active in notification settings' do+ context "with a user having only due_date active in notification settings" dobefore doNotificationSetting.where(user: user_paris)@@ -183,15 +183,15 @@ RSpec.describe Notifications::ScheduleDateAlertsNotificationsJob, type: :job, wioverdue: nil)end- it_behaves_like 'job execution creates date alerts creation job' do+ it_behaves_like "job execution creates date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:00' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:00" }let(:user) { user_paris }endend- context 'with a user having only start_date active in notification settings' do+ context "with a user having only start_date active in notification settings" dobefore doNotificationSetting.where(user: user_paris)@@ -200,15 +200,15 @@ RSpec.describe Notifications::ScheduleDateAlertsNotificationsJob, type: :job, wioverdue: nil)end- it_behaves_like 'job execution creates date alerts creation job' do+ it_behaves_like "job execution creates date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:00' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:00" }let(:user) { user_paris }endend- context 'with a user having only overdue active in notification settings' do+ context "with a user having only overdue active in notification settings" dobefore doNotificationSetting.where(user: user_paris)@@ -217,15 +217,15 @@ RSpec.describe Notifications::ScheduleDateAlertsNotificationsJob, type: :job, wioverdue: 1)end- it_behaves_like 'job execution creates date alerts creation job' do+ it_behaves_like "job execution creates date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:00' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:00" }let(:user) { user_paris }endend- context 'without a user having notification settings' do+ context "without a user having notification settings" dobefore doNotificationSetting.where(user: user_paris)@@ -234,14 +234,14 @@ RSpec.describe Notifications::ScheduleDateAlertsNotificationsJob, type: :job, wioverdue: nil)end- it_behaves_like 'job execution creates no date alerts creation job' do+ it_behaves_like "job execution creates no date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:00' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:00" }endend- context 'with a user having only a project active notification settings' do+ context "with a user having only a project active notification settings" dobefore doNotificationSetting.where(user: user_paris)@@ -257,23 +257,23 @@ RSpec.describe Notifications::ScheduleDateAlertsNotificationsJob, type: :job, wioverdue: nil)end- it_behaves_like 'job execution creates date alerts creation job' do+ it_behaves_like "job execution creates date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:00' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:00" }let(:user) { user_paris }endend- context 'with a locked user' do+ context "with a locked user" dobefore douser_paris.locked!end- it_behaves_like 'job execution creates no date alerts creation job' do+ it_behaves_like "job execution creates no date alerts creation job" dolet(:timezone) { timezone_paris }- let(:scheduled_at) { '1:00' }- let(:local_time) { '1:00' }+ let(:scheduled_at) { "1:00" }+ let(:local_time) { "1:00" }endendend