aboutsummaryrefslogtreecommitdiffstats
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorJamie Winsor <jamie@enmasse.com>2011-09-04 03:20:51 -0700
committerJamie Winsor <jamie@enmasse.com>2011-09-04 14:35:03 -0700
commit7903bdfed26f085f6d07d104ac458bc4319b1e32 (patch)
treefd950e2c1d1d234e0e6a590d24296a4a396798a3 /spec/spec_helper.rb
parent40be4f71ee425ee55ecedea96ff2b0dc510d71db (diff)
downloadrefinerycms-blog-7903bdfed26f085f6d07d104ac458bc4319b1e32.tar.gz
refinerycms-blog-7903bdfed26f085f6d07d104ac458bc4319b1e32.tar.bz2
refinerycms-blog-7903bdfed26f085f6d07d104ac458bc4319b1e32.zip
refactor factories and add #show tests for posts controller
Do not want to cache classes, but do want to reload models after factory girl: http://groups.google.com/group/factory_girl/browse_thread/thread/daa24556d90c31fc http://stackoverflow.com/questions/5145165/associationtypemismatch-and-factorygirl rails_autolink was removed from Rails 3.1 and abstracted to an external gem fix display author name and post time on comment show fix namespace for thanking and moderated flash notices
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb27
1 files changed, 16 insertions, 11 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index a3fe107..b8df592 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -6,34 +6,39 @@ def setup_environment
# need to restart spork for it take effect.
# Configure Rails Environment
- ENV["RAILS_ENV"] ||= 'test'
+ ENV["RAILS_ENV"] = 'test'
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
- require 'factory_girl'
- require 'refinerycms-testing'
-
+
Rails.backtrace_cleaner.remove_silencers!
- Dir[
- File.expand_path("../support/**/*.rb", __FILE__),
- File.expand_path("../factories/**/*.rb", __FILE__)
- ].each {|f| require f}
-
RSpec.configure do |config|
config.mock_with :rspec
- config.use_transactional_fixtures = false
end
end
-def each_run
+def each_run
+ require 'factory_girl_rails'
+ require 'refinerycms-testing'
+
+ Dir[File.expand_path("../../app/models/**/*.rb", __FILE__)].each do |model|
+ load model
+ end
+
+ Dir[
+ File.expand_path("../support/**/*.rb", __FILE__),
+ File.expand_path("../factories/**/*.rb", __FILE__)
+ ].each {|f| require f}
end
# If spork is available in the Gemfile it'll be used but we don't force it.
unless (begin; require 'spork'; rescue LoadError; nil end).nil?
Spork.prefork do
setup_environment
+
+ ActiveSupport::Dependencies.clear
end
Spork.each_run do