Sha256: 7f162989a6ffbd19667d0b36dc56591028261771107573a911a96f7100c90bab

Contents?: true

Size: 1.19 KB

Versions: 87

Compression:

Stored size: 1.19 KB

Contents

ENV["RACK_ENV"] = "test"

require "bundler/setup"

require "active_support/test_case"
require "shoulda/context"
require "minitest/autorun"
require "mongoid"
require "govuk_content_models/require_all"
require "database_cleaner"
require "gds_api/test_helpers/panopticon"
require "webmock/test_unit"
require "govuk_content_models/test_helpers/factories"
require "timecop"

# The models depend on a zone being set, so tests will fail if we don't
Time.zone = "London"

Mongoid.load! File.expand_path("../../config/mongoid.yml", __FILE__)
WebMock.disable_net_connect!

DatabaseCleaner.strategy = :truncation
# initial clean
DatabaseCleaner.clean

class ActiveSupport::TestCase
  PROJECT_ROOT = File.expand_path("../..", __FILE__)

  include GdsApi::TestHelpers::Panopticon

  def without_metadata_denormalisation(*klasses, &block)
    klasses.each {|klass| klass.any_instance.stubs(:denormalise_metadata).returns(true) }
    result = yield
    klasses.each {|klass| klass.any_instance.unstub(:denormalise_metadata) }
    result
  end

  def clean_db
    DatabaseCleaner.clean
  end
  set_callback :teardown, :before, :clean_db

  def timecop_return
    Timecop.return
  end
  set_callback :teardown, :before, :timecop_return
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
govuk_content_models-23.0.0 test/test_helper.rb
govuk_content_models-22.2.0 test/test_helper.rb
govuk_content_models-22.1.2 test/test_helper.rb
govuk_content_models-22.1.1 test/test_helper.rb
govuk_content_models-22.1.0 test/test_helper.rb
govuk_content_models-22.0.0 test/test_helper.rb
govuk_content_models-21.0.0 test/test_helper.rb
govuk_content_models-20.2.0 test/test_helper.rb
govuk_content_models-20.1.0 test/test_helper.rb
govuk_content_models-20.0.0 test/test_helper.rb
govuk_content_models-19.0.0 test/test_helper.rb
govuk_content_models-18.0.0 test/test_helper.rb
govuk_content_models-17.2.1 test/test_helper.rb
govuk_content_models-17.1.1 test/test_helper.rb
govuk_content_models-17.1.0 test/test_helper.rb
govuk_content_models-17.0.0 test/test_helper.rb
govuk_content_models-16.2.0 test/test_helper.rb
govuk_content_models-16.1.1 test/test_helper.rb
govuk_content_models-16.1.0 test/test_helper.rb
govuk_content_models-16.0.0 test/test_helper.rb