Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 67 lines (51 sloc) 1.726 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
# encoding: utf-8
require "rubygems"
require "bundler/setup"
require "rspec"

require "active_model"
require "active_support"
require "action_view"
require "action_controller"
ActiveSupport::Deprecation.silenced = false

require File.expand_path(File.join(File.dirname(__FILE__), "../lib/formtastic/util"))
require File.expand_path(File.join(File.dirname(__FILE__), "../lib/formtastic"))

require "ammeter/init"

require "rspec_tag_matchers"

support_dir = "#{File.dirname(__FILE__)}/support"

require "#{support_dir}/mocks/mock_model"
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories in alphabetic order.
Dir["#{support_dir}/**/*.rb"].sort.each {|f| require f}

include CustomDSL

RSpec.configure do |config|
  config.mock_with :rspec

  config.include Mocks
  config.include Template
  config.include HelperMethods
  config.include CustomMatchers
  config.extend CustomMacros

  config.before(:all) do
    DeferredGarbageCollection.start unless ENV["DEFER_GC"] == "false"
  end
  config.after(:all) do
    DeferredGarbageCollection.reconsider unless ENV["DEFER_GC"] == "false"
  end
  
  # legacy
  config.include RspecTagMatchers
  config.include LegacyMacros
end

require "action_controller/railtie"

# Create a simple rails application for use in testing the viewhelper
module FormtasticTest
  class Application < Rails::Application
    # Configure the default encoding used in templates for Ruby 1.9.
    config.encoding = "utf-8"
    config.active_support.deprecation = :stderr
  end
end
FormtasticTest::Application.initialize!

require "rspec/rails"

# Quick hack to avoid the 'Spec' deprecation warnings from rspec_tag_matchers
module Spec
  include RSpec
end
Something went wrong with that request. Please try again.