spec/spec_helper.rb in hatetepe-0.2.2 vs spec/spec_helper.rb in hatetepe-0.2.3
- old
+ new
@@ -5,13 +5,12 @@
require "em-synchrony"
require "em-synchrony/em-http"
require "fakefs/safe"
RSpec.configure {|config|
- config.before {
+ config.before(:all) {
EM.class_eval {
- @spec_hooks = []
class << self
attr_reader :spec_hooks
def synchrony_with_hooks(blk = nil, tail = nil, &block)
synchrony_without_hooks do
(blk || block).call
@@ -22,16 +21,23 @@
alias_method :synchrony, :synchrony_with_hooks
end
}
}
- config.after {
+ config.after(:all) {
EM.class_eval {
- @spec_hooks = nil
class << self
remove_method :spec_hooks
alias_method :synchrony, :synchrony_without_hooks
remove_method :synchrony_with_hooks
end
}
+ }
+
+ config.before(:each) {
+ EM.instance_variable_set :@spec_hooks, []
+ }
+
+ config.after(:each) {
+ EM.instance_variable_set :@spec_hooks, nil
}
}