diff options
author | Jamie Winsor <jamie@enmasse.com> | 2011-08-01 11:27:28 -0700 |
---|---|---|
committer | Jamie Winsor <jamie@enmasse.com> | 2011-08-03 18:01:32 -0700 |
commit | 21b19db5a30fcb6db83f4ac9302cc94c6320a0db (patch) | |
tree | 62a3b89d0f4c9b239bfd76ec77cfc3269ac041ef /spec/spec_helper.rb | |
parent | 3454a9c3007a4bfd10ccd0ff39dc594ebb2a0184 (diff) | |
download | refinerycms-blog-21b19db5a30fcb6db83f4ac9302cc94c6320a0db.tar.gz refinerycms-blog-21b19db5a30fcb6db83f4ac9302cc94c6320a0db.tar.bz2 refinerycms-blog-21b19db5a30fcb6db83f4ac9302cc94c6320a0db.zip |
refactor engine testing scenario
Engine is now tested standalone by leveraging a dummy rails app
Enable Guard for speedy testing
Move factories to the more standard location `spec/factories/*`
Update README with a Testing section
Rename migrations to contain datetimestamps for their version to fix migration order issues when migrating the dummy application
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..441da1d --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,48 @@ +require 'rubygems' +require 'spork' + +Spork.prefork do + # Loading more in this block will cause your tests to run faster. However, + # if you change any configuration or code from libraries loaded here, you'll + # need to restart spork for it take effect. + + # Configure Rails Environment + ENV["RAILS_ENV"] ||= 'test' + require File.expand_path("../dummy/config/environment.rb", __FILE__) + + require 'rspec/rails' + require 'capybara/rspec' + require 'factory_girl' + require 'devise' + require 'database_cleaner' + + 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 + + config.before(:suite) do + DatabaseCleaner.strategy = :truncation + end + + config.before(:each) do + DatabaseCleaner.start + end + + config.after(:each) do + DatabaseCleaner.clean + end + + config.include Devise::TestHelpers, :type => :controller + end +end + +Spork.each_run do + # This code will be run each time you run your specs. +end |