From 15a41d29579939e94f16ae846f5a6d3a0da4df32 Mon Sep 17 00:00:00 2001 From: Klaus Zanders Date: Fri, 6 Mar 2026 10:34:42 +0100 Subject: [PATCH] Fix specs --- spec/controllers/my_controller_spec.rb | 4 ++-- spec/models/user_spec.rb | 1 + spec/services/user_working_hours/update_service_spec.rb | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/spec/controllers/my_controller_spec.rb b/spec/controllers/my_controller_spec.rb index 689655622f7..bdac1939a24 100644 --- a/spec/controllers/my_controller_spec.rb +++ b/spec/controllers/my_controller_spec.rb @@ -378,10 +378,10 @@ RSpec.describe MyController do expect(response).to render_template "working_hours" end - it "assigns @current_working_hours and @working_hours" do + it "assigns @current_working_hours and @past_working_hours" do subject expect(assigns(:current_working_hours)).to eq(user_working_hours) - expect(assigns(:working_hours)).to eq([user_working_hours]) + expect(assigns(:past_working_hours)).to eq([user_working_hours]) end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index d895b2638d3..b42abf71c96 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1153,6 +1153,7 @@ RSpec.describe User do end it "does not include weekend days within the range" do + week_with_saturday_and_sunday_as_weekend expect(subject).not_to include(Date.new(year, 7, 12), Date.new(year, 7, 13)) end end diff --git a/spec/services/user_working_hours/update_service_spec.rb b/spec/services/user_working_hours/update_service_spec.rb index f7b93da5282..c8b8be5919d 100644 --- a/spec/services/user_working_hours/update_service_spec.rb +++ b/spec/services/user_working_hours/update_service_spec.rb @@ -60,11 +60,11 @@ RSpec.describe UserWorkingHours::UpdateService do end end - context "when the record has today as valid_from (already in effect)" do + context "when the record has today as valid_from (current schedule)" do let(:working_hours) { create(:user_working_hours, user: target_user, valid_from: Date.current) } - it "is unsuccessful" do - expect(service_call).to be_failure + it "is successful because today's schedule is editable in place" do + expect(service_call).to be_success end end