spec/spec_helper.rb in multi_mime-1.0 vs spec/spec_helper.rb in multi_mime-1.0.1

- old
+ new

@@ -11,25 +11,26 @@ 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 -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 + 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 - yield -ensure - values.each do |const, value| - Object.const_set const, value - end -end + +end \ No newline at end of file