2009-09-24 20:06:31 -04:00
|
|
|
require 'rhino'
|
2012-04-13 14:32:31 -04:00
|
|
|
|
2013-03-11 03:46:18 -04:00
|
|
|
begin
|
|
|
|
require 'mocha/api'
|
|
|
|
rescue LoadError
|
|
|
|
require 'mocha'
|
|
|
|
end
|
|
|
|
|
2012-04-13 14:32:31 -04:00
|
|
|
require 'redjs'
|
|
|
|
|
|
|
|
module RedJS
|
|
|
|
Context = Rhino::Context
|
|
|
|
Error = Rhino::JSError
|
|
|
|
end
|
2012-05-18 10:47:12 -04:00
|
|
|
|
2012-09-08 09:39:57 -04:00
|
|
|
module Rhino
|
|
|
|
module SpecHelpers
|
|
|
|
|
|
|
|
def context_factory
|
|
|
|
@context_factory ||= Rhino::JS::ContextFactory.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def context
|
|
|
|
@context || context_factory.call { |ctx| @context = ctx }
|
|
|
|
@context
|
|
|
|
end
|
|
|
|
|
|
|
|
def scope
|
|
|
|
context.initStandardObjects(nil, false)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-05-18 10:47:12 -04:00
|
|
|
RSpec.configure do |config|
|
2012-09-08 09:39:57 -04:00
|
|
|
config.filter_run_excluding :compat => /(0.5.0)|(0.6.0)/ # RedJS
|
|
|
|
config.include Rhino::SpecHelpers
|
2014-02-20 14:38:45 -05:00
|
|
|
config.deprecation_stream = 'spec/deprecations.log'
|
2012-05-18 10:47:12 -04:00
|
|
|
end
|