Sha256: d218c79c76fab22cf9d6734129a39b8458564c9140b9381f0495717fc057ee8a

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require 'spork'
require 'spork/ext/ruby-debug'

Spork.prefork do
  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../dummy/config/environment", __FILE__)
  require 'rspec/rails'
  require 'rspec/autorun'
  require 'shoulda-matchers'
  
  require '<%= namespace %>/testing_support/factories'
  
  Spork.trap_method Rails::Application, :reload_routes!
  Spork.trap_method Rails::Application::RoutesReloader, :reload!
  Spork.trap_method Rails::Application, :eager_load!

  ENGINE_ROOT = File.expand_path("../../", __FILE__)
  Dir["#{ENGINE_ROOT}/spec/support/**/*.rb"].each {|f| require f}

  RSpec.configure do |config|
    config.include FactoryGirl::Syntax::Methods
    
    config.fixture_path = "#{ENGINE_ROOT}/spec/factories"
    config.use_transactional_fixtures = true
    config.infer_base_class_for_anonymous_controllers = false
    config.treat_symbols_as_metadata_keys_with_true_values = true
    config.order = "random"
    
    config.before do
      <%= namespace.camel_case %>.config {}
    end
    
    config.before :each, :admin do
      @request.host = 'admin.<%= namespace %>.dev'
      Rails.application.reload_routes!
    end
  end
end

Spork.each_run do
  Dir[
    "#{ENGINE_ROOT}/app/controllers/**/*.rb",
    "#{ENGINE_ROOT}/app/models/**/*.rb",
    "#{ENGINE_ROOT}/app/serializers/**/*.rb",
    "#{ENGINE_ROOT}/lib/**/*.rb"
  ].each do |file|
    load file
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enginizer-0.0.1 lib/enginizer/templates/%namespaced_name%/spec/spec_helper.rb.tt