spec/spec_helper.rb in multi_mime-0.0.2 vs spec/spec_helper.rb in multi_mime-0.0.3
- old
+ new
@@ -1,34 +1,35 @@
-$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-require "bundler"
+require 'bundler'
Bundler.setup
-begin; require "awesome_print"; rescue LoadError; end
-require "rspec"
-
-require "support/pry"
-require "support/fakefs"
-require "support/simplecov"
-
-require "shared/adapter"
-
-require "multi_mime"
-
-# used as a stupid mixin class
-class DummyClass
+%w(support shared).each do |dir|
+ Dir.glob(File.expand_path("../#{dir}/**/*.rb", __FILE__), &method(:require))
end
-#
-RSpec.configure do |config|
+require 'multi_mime'
- #
+RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect
end
+end
- #
- def jruby?
- defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
- end
+def jruby?
+ defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
+end
-end
\ No newline at end of file
+def undefine_constants(*consts)
+ values = {}
+ consts.each do |const|
+ if Object.const_defined?(const)
+ values[const] = Object.const_get(const)
+ Object.send :remove_const, const
+ end
+ end
+ yield
+ensure
+ values.each do |const, value|
+ Object.const_set const, value
+ end
+end