2009-09-25 00:06:31 +00:00
|
|
|
require 'rhino'
|
2012-04-13 18:32:31 +00:00
|
|
|
|
2013-03-11 07:46:18 +00:00
|
|
|
begin
|
|
|
|
require 'mocha/api'
|
|
|
|
rescue LoadError
|
|
|
|
require 'mocha'
|
|
|
|
end
|
|
|
|
|
2012-04-13 18:32:31 +00:00
|
|
|
require 'redjs'
|
|
|
|
|
|
|
|
module RedJS
|
|
|
|
Context = Rhino::Context
|
|
|
|
Error = Rhino::JSError
|
|
|
|
end
|
2012-05-18 14:47:12 +00:00
|
|
|
|
2012-09-08 13:39:57 +00: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 14:47:12 +00:00
|
|
|
RSpec.configure do |config|
|
2012-09-08 13:39:57 +00:00
|
|
|
config.filter_run_excluding :compat => /(0.5.0)|(0.6.0)/ # RedJS
|
|
|
|
config.include Rhino::SpecHelpers
|
2012-05-18 14:47:12 +00:00
|
|
|
end
|