Sha256: d849ec6e03e00658a6585a993d42deeeeecfca46467a8653eabcd361c772f85a

Contents?: true

Size: 1.33 KB

Versions: 46

Compression:

Stored size: 1.33 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 'govuk_content_models/test_helpers/action_processor_helpers'
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
  include GovukContentModels::TestHelpers::ActionProcessorHelpers

  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

46 entries across 46 versions & 1 rubygems

Version Path
govuk_content_models-34.0.0 test/test_helper.rb
govuk_content_models-33.0.0 test/test_helper.rb
govuk_content_models-32.3.1 test/test_helper.rb
govuk_content_models-32.3.0 test/test_helper.rb
govuk_content_models-32.2.0 test/test_helper.rb
govuk_content_models-32.1.0 test/test_helper.rb
govuk_content_models-32.0.0 test/test_helper.rb
govuk_content_models-31.4.0 test/test_helper.rb
govuk_content_models-31.3.0 test/test_helper.rb
govuk_content_models-31.2.2 test/test_helper.rb
govuk_content_models-31.2.1 test/test_helper.rb
govuk_content_models-31.2.0 test/test_helper.rb
govuk_content_models-31.1.0 test/test_helper.rb
govuk_content_models-31.0.0 test/test_helper.rb
govuk_content_models-30.0.0 test/test_helper.rb
govuk_content_models-29.1.2 test/test_helper.rb
govuk_content_models-29.1.1 test/test_helper.rb
govuk_content_models-29.1.0 test/test_helper.rb
govuk_content_models-29.0.1 test/test_helper.rb
govuk_content_models-29.0.0 test/test_helper.rb