spec/spec_helper.rb in cacheable_flash-0.2.3 vs spec/spec_helper.rb in cacheable_flash-0.2.4
- old
+ new
@@ -1,20 +1,27 @@
-#TODO: Specs will need a 'test' rails app to run within, or to mock things like ::Rails.root
+# Configure Rails Envinronment
+ENV["RAILS_ENV"] = "test"
+require File.expand_path("../dummy/config/environment", __FILE__)
-require 'rspec'
+require 'rspec/rails'
require "json"
-require "active_support"
-require "action_controller"
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-$LOAD_PATH.unshift(File.dirname(__FILE__))
+ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
+# Requires supporting ruby files with custom matchers and macros, etc,
+# in spec/support/ and its subdirectories.
+Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
+
require 'cacheable_flash'
-require "support/test_helpers"
+# Instead of loading the installed gem, we load the source code directly, would this work?
+#$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+#$LOAD_PATH.unshift(File.dirname(__FILE__))
+require 'support/test_helpers'
+
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
+#Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
-
+ config.include CacheableFlash::TestHelpers, :type => :controller
end