Sha256: 4c13ed15eb1db1879c2517a6a8b6d4e6392c19003ae0fdfc1192d90d05afdf85

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

# Configure Rails Environment
ENV["RAILS_ENV"] = "test"

require File.expand_path("../dummy/config/environment.rb",  __FILE__)
require "rails/test_help"
require "mocha/setup"

Rails.backtrace_cleaner.remove_silencers!

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

# Load fixtures from the engine
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
  ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
end


class ActiveSupport::TestCase

  # Note: You'll currently still have to declare fixtures explicitly in integration tests
  # -- they do not yet inherit this setting
  fixtures :all

  setup do

    $advert_selector_banners_load_time = nil # force reload of banners in every tests
    @coke = advert_selector_banners(:coke)
    @pepsi = advert_selector_banners(:pepsi)
    @parade_banner = advert_selector_banners(:parade_banner)

    Timecop.return
    Timecop.travel( Time.now.at_midnight + 12.hours ) unless [6..20].include?(Time.now.hour)
  end

  teardown do
    Timecop.return
    $advert_selector_avoid_cache = false
    @coke.reset_cache
    @pepsi.reset_cache
    @parade_banner.reset_cache
    AdvertSelector::ErrorsCache.clear
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
advert_selector-2.0.1 test/test_helper.rb