test_app/spec/spec_helper.rb in bushido-0.0.34 vs test_app/spec/spec_helper.rb in bushido-0.0.35
- old
+ new
@@ -1,11 +1,21 @@
-require File.expand_path('../boot', __FILE__)
+#require File.expand_path('../boot', __FILE__)
+require File.expand_path("../../config/environment", __FILE__)
+require 'rspec/rails'
+# 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}
+
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
+# Add this to load Capybara integration:
+require 'capybara/rspec'
+require 'capybara/rails'
+
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module TestApp
@@ -38,7 +48,19 @@
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
+ end
+end
+
+
+def preserve_envs(*keys, &block)
+ cache = {}
+ keys.each { |key| cache[key] = ENV[key] }
+
+ begin
+ yield
+ ensure
+ keys.each { |key| ENV[key] = cache[key] }
end
end