Last active
December 12, 2015 02:09
-
-
Save nowk/4696623 to your computer and use it in GitHub Desktop.
Spork reloads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group :development, :test do | |
# require false fixes ActiveRecord::AssociationTypeMismatch | |
# gem 'factory_girl', :require => false | |
gem 'factory_girl_rails', :require => false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /spec/spec_helper.rb | |
Spork.prefork do | |
ENV['RAILS_ENV'] ||= 'test' | |
# this is the only thing that fixes in Rails 4.beta. Only pertains to Devise models, other models seem to reload fine. | |
require 'rails/application' | |
Spork.trap_method(Rails::Application, :reload_routes!) | |
Spork.trap_method(Rails::Application::RoutesReloader, :reload!) | |
require File.expand_path("../../config/environment", __FILE__) | |
# ... rest of spec helper | |
end | |
Spork.each_run do | |
# ActiveSupport::Dependencies.clear | |
# Must reload here or feature tests fail | |
Spork.trap_method(Rails::Application, :reload_routes!) | |
Spork.trap_method(Rails::Application::RoutesReloader, :reload!) | |
require 'factory_girl_rails' | |
# reload turnip steps | |
Dir.glob("spec/acceptance/steps/**/*steps.rb") { |f| load f, true } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/environments/test.rb | |
Namespace::Application.configure do | |
config.cache_classes = true | |
# this seems to cause TypeMismatch errors | |
# config.cache_classes = !(ENV['DRB'] == 'true') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment