<commit_before>require 'spec_helper'

describe Delayed::Job do
  before(:all) do
    @backend = Delayed::Job
  end
  
  before(:each) do
    Delayed::Worker.max_priority = nil
    Delayed::Worker.min_priority = nil
    Delayed::Job.delete_all
    SimpleJob.runs = 0
  end
  
  after do
    Time.zone = nil
  end
  
  it_should_behave_like 'a backend'

  context "db_time_now" do
    it "should return time in current time zone if set" do
      Time.zone = 'Eastern Time (US & Canada)'
      Delayed::Job.db_time_now.zone.should == 'EST'
    end
    
    it "should return UTC time if that is the AR default" do
      Time.zone = nil
      ActiveRecord::Base.default_timezone = :utc
      Delayed::Job.db_time_now.zone.should == 'UTC'
    end

    it "should return local time if that is the AR default" do
      Time.zone = 'Central Time (US & Canada)'
      ActiveRecord::Base.default_timezone = :local
      Delayed::Job.db_time_now.zone.should == 'CST'
    end
  end
  
end<commit_msg>Fix test for daylight saving time<commit_after>require 'spec_helper'

describe Delayed::Job do
  before(:all) do
    @backend = Delayed::Job
  end
  
  before(:each) do
    Delayed::Worker.max_priority = nil
    Delayed::Worker.min_priority = nil
    Delayed::Job.delete_all
    SimpleJob.runs = 0
  end
  
  after do
    Time.zone = nil
  end
  
  it_should_behave_like 'a backend'

  context "db_time_now" do
    it "should return time in current time zone if set" do
      Time.zone = 'Eastern Time (US & Canada)'
      %w(EST EDT).should include(Delayed::Job.db_time_now.zone)
    end
    
    it "should return UTC time if that is the AR default" do
      Time.zone = nil
      ActiveRecord::Base.default_timezone = :utc
      Delayed::Job.db_time_now.zone.should == 'UTC'
    end

    it "should return local time if that is the AR default" do
      Time.zone = 'Central Time (US & Canada)'
      ActiveRecord::Base.default_timezone = :local
      %w(CST CDT).should include(Delayed::Job.db_time_now.zone)
    end
  end
  
end
{'fraction_non_alphanumeric': 0.09504950495049505, 'fraction_numerical': 0.0009900990099009901, 'mean_word_length': 2.8422053231939164, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6463855', 'n_tokens_mistral': 701, 'n_tokens_neox': 675, 'n_words': 192}