spec/spec_helper.rb in rhoconnect-3.1.2 vs spec/spec_helper.rb in rhoconnect-3.2.0.beta1
- old
+ new
@@ -5,10 +5,44 @@
if RUBY_VERSION =~ /1.9/ || defined?(JRUBY_VERSION)
require 'simplecov'
SimpleCov.start
end
+# all specs are Async'd in new ruby
+if RUBY_VERSION =~ /1.9/
+ require 'eventmachine'
+ require 'fiber'
+
+ Thread.abort_on_exception = true
+
+ module RSpec
+ module Core
+ class ExampleGroup
+
+ class << self
+ alias_method :run_alias, :run
+
+ def run(reporter)
+ if EM.reactor_running?
+ run_alias reporter
+ else
+ out = nil
+ EM.run do
+ Fiber.new {
+ out = run_alias reporter
+ EM.stop
+ }.resume
+ end
+ out
+ end
+ end
+ end
+ end
+ end
+ end
+end
+
require 'rhoconnect'
include Rhoconnect
# require RSpec shared examples
SPEC_PATH = File.expand_path(File.dirname(__FILE__))
@@ -219,9 +253,26 @@
"property" => {
"name" => "string",
"brand" => "string"
},
"version" => "1.0"
+ }.to_json
+ end'
+ end
+ yield
+ adapters.each do |klass|
+ klass.class_eval "def schema; end"
+ end
+ end
+
+ def mock_schema_no_version_method(adapters, &block)
+ adapters.each do |klass|
+ klass.class_eval 'def schema
+ {
+ "property" => {
+ "name" => "string",
+ "brand" => "string"
+ }
}.to_json
end'
end
yield
adapters.each do |klass|