Permalink
Browse files

Added rspec configuration.

  • Loading branch information...
1 parent 432ea30 commit f941d0c468f7c191b2a28b853b6d91204149ce08 Dave South committed Aug 30, 2010
Showing with 46 additions and 0 deletions.
  1. +1 −0 .rspec
  2. +2 −0 autotest/discover.rb
  3. +43 −0 spec/spec_helper.rb
View
1 .rspec
@@ -0,0 +1 @@
+--colour
View
2 autotest/discover.rb
@@ -0,0 +1,2 @@
+Autotest.add_discovery { "rails" }
+Autotest.add_discovery { "rspec2" }
View
43 spec/spec_helper.rb
@@ -0,0 +1,43 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+ENV["RAILS_ENV"] ||= 'test'
+require File.expand_path("../../config/environment", __FILE__)
+require 'rspec/rails'
+require 'database_cleaner'
+require 'fabrication'
+
+# Requires supporting ruby files with custom matchers and macros, etc,
+# in spec/support/ and its subdirectories.
+Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+
+RSpec.configure do |config|
+ # == Mock Framework
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+ config.mock_with :rspec
+
+ # Mongoid doesn't work well with fixtures
+ # Use fabrication instead
+ #
+ # config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # Mongoid cannot support transactions
+ # Use database_cleaner to teardown collections
+ #
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, comment the following line or assign false
+ # instead of true.
+ # config.use_transactional_fixtures = true
+
+ config.before(:suite) do
+ DatabaseCleaner.orm = "mongoid"
+ DatabaseCleaner.strategy = :truncation
+ end
+
+ config.before(:each) do
+ DatabaseCleaner.clean
+ end
+end

0 comments on commit f941d0c

Please sign in to comment.