diff --git a/app/services/feature_toggle.rb b/app/services/feature_toggle.rb index 827e87da9..4b2c440fc 100644 --- a/app/services/feature_toggle.rb +++ b/app/services/feature_toggle.rb @@ -1,6 +1,6 @@ class FeatureToggle def self.allow_future_form_use? - Rails.env.development? || Rails.env.review? || Rails.env.staging? || Rails.env.test? + Rails.env.development? || Rails.env.review? || Rails.env.staging? end def self.bulk_upload_duplicate_log_check_enabled? diff --git a/spec/models/lettings_log_derived_fields_spec.rb b/spec/models/lettings_log_derived_fields_spec.rb index a6e19f5c4..ced14af9f 100644 --- a/spec/models/lettings_log_derived_fields_spec.rb +++ b/spec/models/lettings_log_derived_fields_spec.rb @@ -1251,6 +1251,12 @@ RSpec.describe LettingsLog, type: :model do context "and it is 2025", metadata: { year: 25 } do let(:startdate) { collection_start_date_for_year(2025) } + around do |example| + Timecop.freeze(collection_start_date_for_year(2025)) do + example.run + end + end + it "does not clear the relationship" do expect { log.set_derived_fields! }.to not_change(log, :relat2) end @@ -1259,6 +1265,13 @@ RSpec.describe LettingsLog, type: :model do context "and it is 2026", metadata: { year: 26 } do let(:startdate) { collection_start_date_for_year(2026) } + around do |example| + Timecop.freeze(collection_start_date_for_year(2026)) do + Singleton.__init__(FormHandler) + example.run + end + end + it "clears the relationship" do expect { log.set_derived_fields! }.to change(log, :relat2).from("X").to(nil) end @@ -1276,6 +1289,13 @@ RSpec.describe LettingsLog, type: :model do context "and it is 2025", metadata: { year: 25 } do let(:startdate) { collection_start_date_for_year(2025) } + around do |example| + Timecop.freeze(collection_start_date_for_year(2025)) do + Singleton.__init__(FormHandler) + example.run + end + end + it "does not clear the relationship" do expect { log.set_derived_fields! }.to not_change(log, :relat2) end @@ -1284,6 +1304,13 @@ RSpec.describe LettingsLog, type: :model do context "and it is 2026", metadata: { year: 26 } do let(:startdate) { collection_start_date_for_year(2026) } + around do |example| + Timecop.freeze(collection_start_date_for_year(2026)) do + Singleton.__init__(FormHandler) + example.run + end + end + it "does not clear the relationship" do expect { log.set_derived_fields! }.to not_change(log, :relat2) end @@ -1301,6 +1328,13 @@ RSpec.describe LettingsLog, type: :model do context "and it is 2025", metadata: { year: 25 } do let(:startdate) { collection_start_date_for_year(2025) } + around do |example| + Timecop.freeze(collection_start_date_for_year(2025)) do + Singleton.__init__(FormHandler) + example.run + end + end + it "does not clear the relationship" do expect { log.set_derived_fields! }.to not_change(log, :relat2) end @@ -1309,6 +1343,13 @@ RSpec.describe LettingsLog, type: :model do context "and it is 2026", metadata: { year: 26 } do let(:startdate) { collection_start_date_for_year(2026) } + around do |example| + Timecop.freeze(collection_start_date_for_year(2026)) do + Singleton.__init__(FormHandler) + example.run + end + end + it "does not clear the relationship" do expect { log.set_derived_fields! }.to not_change(log, :relat2) end