spec/delayed/job_spec.rb in delayed-0.2.0 vs spec/delayed/job_spec.rb in delayed-0.3.0

- old
+ new

@@ -737,29 +737,35 @@ expect(described_class).to have_received(:reserve_with_scope_using_default_sql).once end end end + if ActiveRecord::VERSION::MAJOR >= 7 + delegate :default_timezone=, to: ActiveRecord + else + delegate :default_timezone=, to: ActiveRecord::Base + end + context "db_time_now" do after do Time.zone = nil - ActiveRecord::Base.default_timezone = :local + self.default_timezone = :local end it "returns time in current time zone if set" do Time.zone = "Arizona" expect(described_class.db_time_now.zone).to eq("MST") end it "returns UTC time if that is the AR default" do Time.zone = nil - ActiveRecord::Base.default_timezone = :utc + self.default_timezone = :utc expect(described_class.db_time_now.zone).to eq "UTC" end it "returns local time if that is the AR default" do Time.zone = "Arizona" - ActiveRecord::Base.default_timezone = :local + self.default_timezone = :local expect(described_class.db_time_now.zone).to eq("MST") end end context "ActiveRecord::Base.table_name_prefix" do